Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

f# compiling too slow

Tags:

I'm new to f#. I downloaded the Visual Studio 2010 shell and the F# ctp and wrote a small hello world script with the following code

printfn "Hello World"
let _ = System.Console.ReadLine()

This takes around 13 to 15 seconds to compile which is very slow compared to running a similar C# script(which takes around 2 secs). I'd like the F# script to compile faster so that my development(i.e. experimentation) time would be reduced, I don't care for the runtime performance.

Is there any way to make the F# script compile faster, maybe turn on/off some Build settings in Visual Studio or something like that?

FYI, I'm using a 4 year old pentium 4, 1.5 gb RAM machine, if that helps.

like image 630
user547057 Avatar asked Jan 15 '11 03:01

user547057


1 Answers

I have no idea how fast a Pentium 4 should compile that "hello world" program, but 15 seconds strikes me as pretty slow. I once had similar speed problems with a VS 2010 Beta and the problem turned out to be that Visual Studio and the F# compiler weren't yet properly NGENed.

Normally, the Visual Studio install should make sure that everything gets NGENed, but maybe something went wrong. You can check if the F# compiler was NGENed with the following command in a console window with admin rights:

cd "C:\Program Files\FSharp-2.0.0.0\bin"
c:\windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe display fsc.exe

If the result of that shows that the native image of fsc.exe is still pending, you could force the compilation with:

c:\windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe executeQueuedItems

Note: I'm not sure which version of the F# compiler you're using exactly. The one used by the full install of VS2010 is the one in C:\Program Files\Microsoft F#\v4.0 (or C:\Program Files (x86)\Microsoft F#\v4.0 on 64-bit machines). So, if you use that one, you have to cd into that folder instead of the C:\Program Files\FSharp-2.0.0.0\bin folder.

like image 134
Stephan Tolksdorf Avatar answered Nov 28 '22 09:11

Stephan Tolksdorf