F # Interactive faster than compiled

I recently noticed that F # Interactive is much faster than the compiled version (in Release or Debug mode). Here is an example:

let rec fib n = if n < 3 then 1 else fib (n-1) + fib (n-2) [<EntryPoint>] let rec main argv = let w = System.Diagnostics.Stopwatch() w.Start() fib 45 w.Stop() printfn "%d" w.ElapsedMilliseconds System.Console.ReadLine() 0 

When compiling in release mode, execute these outputs “12784” when “4986” comes out in F # Interactive. I run it interactively using "main [||] ;;".

Something strange is definitely happening, but I have no idea what!

EDIT [Specs]: F # 3.0 for .NET 4. Code optimization is installed and flag flags are generated, and I am compiling for x86. I am running this on the i7 950. I am using visual studio 2012.

+4
source share
2 answers

Ran is executable outside of VS2012, as suggested by the pad, and then changed to .NET 4.5. This equalized the runtime.

+3
source

Please see my answer: What makes this F # so slow in VS2012?

You need to add the Fsharp.core.dll file to your exe file so that it loads faster.

-1
source

All Articles