
That's odd. Making things more global can reduce optimisation opportunities, but making things ore local should not. You can say -ddump-simpl to get an idea of what the differences are. If you can make a smallish repo case, I'll take a look, though perhaps not before ICFP. Simon | -----Original Message----- | From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users- | bounces@haskell.org] On Behalf Of Michael Marte | Sent: 05 September 2006 17:40 | To: glasgow-haskell-users@haskell.org | Subject: Program slower with local definitions | | 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 | _______________________________________________ | Glasgow-haskell-users mailing list | Glasgow-haskell-users@haskell.org | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users