turn off let floating
Bernard James POPE
bjpop at cs.mu.OZ.AU
Wed Apr 21 12:02:32 EDT 2004
> There's another way which you missed: using implicit parameters. I
> remember reading a paper a while ago called Global Variables in Haskell
> (sorry, don't remember the author -- Jones, perhaps?) which did similar
> benchmarking to yours, and carrying around the global variable with an
> implicit parameter was faster than using a global mutable counter via
> "unsafePerformIO $ newIORef ...".
Thanks for the note. That was in the paper by John Hughes. The
performance difference between unsafePerformIO and implicit parameters
is not significant in his test case. I think he was surprised that
implicit parameters worked so well (I am too).
That doesn't mean I should rule it out completely. I'll have a look into
Also, implicit parameters are less convenient for the program transformation
that I use in buddha, whereas a truly global variable is ideal.
On the other hand the FFI approach looks a lot faster already, and Simon
has suggested that I can inline unsafePerformIO.
More information about the Glasgow-haskell-users