Bools are not unboxed
simonpj at microsoft.com
Mon Oct 4 08:13:20 EDT 2004
| > for :: Int -> IO () -> IO ()
| > for 0 _ = return ()
| > for n x = x >> for (n - 1) x
Good example (allocates lots of silly thunks). I'd come across this
before, and fixed the HEAD, but the 6.2 branch is still doing badly.
We'll try to fix that.
| Playing with the code generated by ghc is a great way to waste time
| for me. Wait until you have found the RULES-pragma :-)
In general, GHC's optimiser should behave predictably; small changes in
the source program should not have big effects. Of course, sometimes
they do, and for good reason. But not always; I'm keen to identify
cases where the optimiser does a poor/unpredictable job, and fix them.
So please let me know when that happens. The more you can boil down a
program, and identify the culprit, as Carsten did so accurately in this
case, the more likely I am to fix it. At the other end of the spectrum
"this 1000 line program goes slower than I expect" is less helpful :-)
Incidentally, GHC does use pre-allocated True and False booleans.
More information about the Glasgow-haskell-users