tags:

views:

313

answers:

2

As of F# 1.9.6.16 and Mono 2.4.2.3 I am failing to AOT the F# assemblies, getting a segmentation fault. fsi is barely usable (and sometimes crashes), and fsc is quite painfully slow. Under windows, F# is not the fastest compiler either. Is there anything to help the situation?

+3  A: 

The best way to help this situation is to file bugs. If you have a particular project or environment which is having a significant slow down I highly encourage you to file a bug. Often times real world customer scenarios are very instructive in tracking down performance problems in products.

F#, like the rest of the languages in visual studio, process customer bugs filed via Microsoft's connect website.

(EDIT: In the specific case of F#, you are also welcome to email [email protected].)

JaredPar
Do you fix bugs that may be an interaction between the F# compiler and mono? <g>
James Black
@James, I don't work on F# so I don't have a point of reference. Probably the best place to ask this is on [email protected]
JaredPar
As far as I know from sending bugs to [email protected], they don't support Mono, but are working on a general compiler speedup for the next release. Would be interesting to know if anything can be done right now without waiting for the new F#.
toyvo
+2  A: 

I just found a way to write F# scripts on Linux that do not rely on fsi but rather automatically recompile and are therefore reasonably fast:

Given /usr/local/bin/fsx:

#!/bin/bash
src=$1
tgt=$src.exe
if [[ $src -nt $tgt ]]
then
    fsc $src -o $tgt >/dev/null && exec mono $tgt
else
    exec mono $tgt
fi

One can write scripts that omit the shebang, relying on the default shell:

#light (*
    exec fsx $0
*)

printfn "Hello, world!"

When run, the shell skips the first line thinking it is a comment, and runs exec fsx $0, which compiles the script with fsc if the executable is out of date, and then runs it. For F#, the shell command is just a comment.

toyvo
That's a very cute hack!
MichaelGG