compiling huge HashSet hogs memory
Compiling a huge (~2.5k elements) set with GHC-7.10.1 or GHC-head and unordered-containers-0.2.5.1 or unordered-containers-head takes way too much memory. Here is a file which I am trying to compile. I've also set up a travis build which demonstrates the behaviour with different versions of GHC and unordered-containers. Further I would be referring to this build-job which uses GHC-7.10.1 and unordered-containers-0.2.5.1.
- Compilation with default optimization options takes around 12GB of memory.
-
Compilation with
-O0takes around 400MB. -
Compilation with
-O2takes around 12GB of memory. -
Compilation with
-O2 -fignore-interface-pragmastakes around 500MB of memory, which solves the problem.
When the build uses GHC-7.8.4, neither of this hogging occurs.
Another interesting observation is that compiling HashMap of the same size, doesn't cause memory hogging even with -O2. This attracted my attention as HashSet is implemented in terms of HashMap.
I reported the issue to unordered-containers as well: link.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.10.1 |
| Type | Bug |
| TypeOfFailure | RuntimePerformance |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |