
5 Sep
2006
5 Sep
'06
12:40 p.m.
Hello *, I noticed a five percent speed up by making local definitions global. This is the first version with local definitions: f = <some expression based on mySet> where mySet = foldl (flip Set.insert) Set.empty myList myList = <some constant list> Then I moved mySet and myList to the top level which gave me the speed up. Shouldn't both versions show the same behaviour with regard to run time? Doesn't the compiler lift mySet and myList to top level automatically? Are myList and mySet evaluated in every call to f when defined locally? I am using ghc 6.4.2 on Windows XP. Michael