Hi Andre, > 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 it. 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. Cheers, Bernie. _______________________________________________ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
