[GHC] #10289: compiling huge HashSet hogs memory

GHC ghc-devs at haskell.org
Sun Apr 12 13:31:30 UTC 2015


#10289: compiling huge HashSet hogs memory
-------------------------------------+-------------------------------------
              Reporter:  zudov       |             Owner:
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:
             Component:  Compiler    |           Version:  7.10.1
              Keywords:              |  Operating System:  Linux
          Architecture:  x86_64      |   Type of failure:  Runtime
  (amd64)                            |  performance bug
             Test Case:              |        Blocked By:
              Blocking:              |   Related Tickets:
Differential Revisions:              |
-------------------------------------+-------------------------------------
 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 [https://github.com/zudov/html5-entity/blob/unordered-
 containers/src/Text/Html/Entity/Data/EntitySet.hs file] which I am trying
 to compile. I've also set up a [https://travis-
 ci.org/zudov/html5-entity/builds/58063328 travis build] which demonstrates
 the behaviour with different versions of GHC and unordered-containers.
 Further I would be referring to [https://travis-
 ci.org/zudov/html5-entity/jobs/58063332 this build-job] which uses
 GHC-7.10.1 and unordered-containers-0.2.5.1.
 * [https://travis-ci.org/zudov/html5-entity/jobs/58063332#L397
 Compilation] with default optimization options takes around [https
 ://travis-ci.org/zudov/html5-entity/jobs/58063332#L408 12GB] of memory.
 * [https://travis-ci.org/zudov/html5-entity/jobs/58063332#L367
 Compilation] with `-O0` takes around [https://travis-
 ci.org/zudov/html5-entity/jobs/58063332#L378 400MB].
 * [https://travis-ci.org/zudov/html5-entity/jobs/58063332#L457
 Compilation] with `-O2` takes around [https://travis-
 ci.org/zudov/html5-entity/jobs/58063332#L468 12GB] of memory.
 * [https://travis-ci.org/zudov/html5-entity/jobs/58063332#L487
 Compilation] with `-O2 -fignore-interface-pragmas` takes around [https
 ://travis-ci.org/zudov/html5-entity/jobs/58063332#L498 500MB] of memory,
 which solves the problem.
 When the build uses GHC-7.8.4, neither of this hogging [https://travis-
 ci.org/zudov/html5-entity/jobs/58063330 occurs].
 Another interesting observation is that [https://travis-
 ci.org/zudov/html5-entity/jobs/58063330#L339 compiling]
 [https://github.com/zudov/html5-entity/blob/unordered-
 containers/src/Text/Html/Entity/Data/EntityMap.hs 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:
 [https://github.com/tibbe/unordered-containers/issues/100 link].

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10289>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list