#3664: Ghc eats tremendous heaps of RAM in -prof build (highlighting-kate)
-------------------------------------------+--------------------------------
Reporter: slyfox | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 6.12 branch
Component: Compiler | Version: 6.12.1 RC1
Resolution: | Keywords:
Difficulty: | Os: Linux
Testcase: | Architecture: x86_64 (amd64)
Failure: Compile-time performance bug |
-------------------------------------------+--------------------------------
Comment (by simonpj):
Thanks for the nice test case.
Happily the performance hole is fixed in the HEAD, I believe by my recent
patch to `FloatOut`:
{{{
Mon Dec 7 08:32:46 GMT 2009 [email protected]
* Fix a nasty (and long-standing) FloatOut performance bug
The effect was that, in deeply-nested applications, FloatOut would
take quadratic time. A good example was compiling
programs/barton-mangler-bug/Expected.hs
in which FloatOut had a visible pause of a couple of seconds!
Profiling showed that 40% of the entire compile time was being
consumbed by the single function partitionByMajorLevel.
The bug was that the floating bindings (type FloatBinds) was kept
as a list, which was partitioned at each binding site. In programs
with deeply nested lists, such as
e1 : e2 : e3 : .... : e5000 : []
this led to quadratic behaviour.
The solution is to use a proper finite-map representation;
see the new definition of FloatBinds near the bottom of FloatOut.
M ./compiler/simplCore/FloatOut.lhs -76 +126
}}}
Here are the stats for your run:
{{{
15,066,832,088 bytes allocated in the heap
2,907,321,496 bytes copied during GC
188,073,960 bytes maximum residency (28 sample(s))
6,128,376 bytes maximum slop
412 MB total memory in use (7 MB lost due to fragmentation)
}}}
Note the residency is 188M, still large but more manageable.
Because 6.12.1 is otherwise ready to go we were planning to put this patch
6.12.2, rather than risk destabilising 6.12.1 (the patch has not been
tested nearly as thoroughly as the rest of 6.12.1). Can you use the HEAD
meanwhile?
I'm leaving the bug open just for this question to be resolved.
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3664#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs