I am wondering how the performance of F # compares with the performance of C ++?
Varies by application. If you use complex data structures a lot in a multi-threaded program, then F # is likely to be a big win. If most of your time is spent in hard numerical loops mutating arrays, then C ++ can be 2-3 times faster.
Case study: ray tracer In my test here I use a tree for hierarchical selection and a numerical ray intersection code to create an output image. This figure is several years old, and C ++ code has been improved dozens of times over the years and is read by hundreds of thousands of people. Don Sim managed to write an F # implementation at Microsoft, which is slightly faster than the fastest C ++ code when compiling with MSVC and is parallelized using OpenMP.
I read that F # should be more scalable and more productive, but how does this real performance compare with C ++?
Code development is much simpler and faster with F # than C ++, and that concerns optimization as well as maintenance. Therefore, when you start optimizing the program, the same amount of effort will bring a much greater performance boost if you use F # instead of C ++. However, F # is a higher level language and therefore puts the lower ceiling in performance. Therefore, if you have infinite time for optimization, you should theoretically always be able to create faster C ++ code.
This is the same advantage that C ++ has over Fortran, and Fortran, of course, was involved in a handwritten compiler.
Example: QR Decomposition This is a basic numerical method from linear algebra provided by libraries such as LAPACK. Reference LAPACK implementation - 2077 Fortran lines. I wrote an F # implementation in 80 lines of code that achieve the same level of performance. But the reference implementation is not fast: vendor-based implementations such as the Intel Math Kernel Library (MKL) are often 10 times faster. It is noteworthy that I was able to optimize the F # code much higher than Intel's performance on Intel hardware, keeping my code up to 150 lines of code and completely universal (it can handle single and double precision, as well as complex and even symbolic matrices!): For high thin matrices my F # code is up to 3 times faster than Intel MKL.
Note that the moral of this study is not that you should expect your F # to be faster than libraries configured to work with manufacturers, but rather, even experts like Intel will skip productive high-level optimizations. if they will use only lower levels of languages. I suspect that Intel’s numerical optimization specialists have not been able to make full use of parallelism because their tools make it extremely cumbersome while F # makes it easy.
How well does it work with floating point?
Performance is similar to ANSI C, but some features (such as rounding modes) are not available in .NET.
Does it allow vector instructions
No.
how friendly is it to optimize compilers?
This question does not make sense: F # is Microsoft's own .NET .NET language with one compiler.
How big is print printing in memory?
The empty application uses 1.3Mb here.
Does it provide fine-grained control over memory locality?
Better than most memory-safe languages, but not as good as C. For example, you can decompress arbitrary data structures in F #, representing them as "structures".
Does it have capacity for distributed memory processors like Cray?
Depends on what you mean by "ability." If you can run .NET on this Cray, then you can use messaging in F # (as in the following language), but F # is primarily for x86 desktop multicore machines.
what functions does it have that might be of interest for computational science, in which heavy number processing is involved?
Memory security means that you do not get segmentation errors and access violations. Support for parallelism in .NET 4 is good. The ability to execute code on the fly through an interactive F # session in Visual Studio 2010 is extremely useful for interactive technical computing.
Are there real scientific computing implementations that use it?
Our commercial scientific computing products in F # already have hundreds of users.
However, your survey line indicates that you are thinking of scientific computing as high-performance computing (e.g. Cray), and not interactive technical computing (e.g. MATLAB, Mathematica). F # is for the latter.