Compiler performance bug: large "do" expression
From Neil Mitchell:
Using GHC 6.4.2 on Windows and 6.4.1 on Linux, I get really poor compile time performance for large do blocks - for example:
main = do return () return () .... return ()
The following are the compile times in seconds for a given number of return () lines, GHC 6.4.1 on Linux, with a very beefy processor (my department server) and loads of RAM.
100 1.444 200 4.054 300 7.977 400 13.967 500 21.265 600 30.71 700 43.997
For comparison on my desktop machine I get out of heap space with 268Mb of heap, in a few minutes for 700. Compared to Hugs and Yhc, which both deal with all of these files instantly.
By splitting the 700 line do block into 7 separate do blocks, each 100 lines, I get a compile time of 8.530.
The particular reason I was running into this issue was with an auto generated file of tests, about 360 lines of reasonably lines in a do block, which exhausted the memory in GHCi. I have modified my test generator to split the files into 50 line blocks.