F# performance question: what is the compiler doing?
- by Stephen Swensen
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).