-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

F# High Performance
By :

F# has common bottlenecks although they might be subtle as well.
In order to be able to quickly understand the bottleneck factors in F#, we will categorize the shared general bottlenecks of .NET as managed bottlenecks (also in C#/VB), and F#-only bottlenecks (this includes when using F# with other languages).
The following are managed .NET bottlenecks (from obvious to less obvious):
String.Concat
instead of StringBuilder
. This is often overlooked because of a lack of awareness of the string's immutability.ArrayList
.DataSet
that has DataTables
over HTTP.Side effects mean all of the elements outside the formal computation (it is often called the outside world) that we interact with, and this includes the changing global state. The outside world can be all of the things that we cannot fully determine as the end result. Examples of the outside world include:
public static
variable in the scope of ASP.NET. Every value change will always change the condition of any user of the ASP.NET application.DateTime.Now
.
DateTime.Now
will always return different results and this is as expected because the result must change every time it is called or instantiated. It is not free of side effects, but it is still expected to always return a different result.
Side effects are not just for functional programming developers, as many of us are now becoming quite aware. There are no absolute side effect-free computations because we should learn and be able to correctly handle them. For example, even printing a screen to a console is also a side effect because it involves I/O, and it changes the state of the outside world.
The following are F#'s unique bottlenecks:
MailboxProcessor
in F#Change the font size
Change margin width
Change background colour