F# performance question: what is the compiler doing?

Posted by Stephen Swensen on Stack Overflow See other posts from Stack Overflow or by Stephen Swensen
Published on 2010-05-31T20:38:21Z Indexed on 2010/05/31 20:43 UTC
Read the original article Hit count: 368

Filed under:
|

Referencing this code: http://stackoverflow.com/questions/2840714/f-static-member-type-constraints/2842037#2842037

Why is, for example,

[1L..100000L] |> List.map (fun n -> factorize gL n)

significantly slower than

[1L..100000L] |> List.map (fun n -> factorize (G_of 1L) n)

By looking at Reflector, I can see that the compiler is treating each of these in very different ways, but there is too much going on for me to decipher the essential difference. Naively I assumed the former would perform better than the later because gL is precomputed whereas G_of 1L has to be computed 100,000 times (at least it appears that way).

© Stack Overflow or respective owner

Related posts about F#

Related posts about compilation