
#9885: ghc-pkg parser eats too much memory
-------------------------------------+-------------------------------------
Reporter: gnezdo | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: ghc-pkg | Version: 7.8.3
Resolution: | Keywords:
Operating System: Linux | Architecture: Unknown/Multiple
Type of failure: Runtime | Difficulty: Moderate (less
performance bug | than a day)
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by gnezdo):
I did some profiling. To save somebody a bit of digging, reproducing the
build/profile/plot script here (would love to hear how to do this more
optimally):
{{{
#!/bin/bash
# Demonstrates memory consumption behavior of ghc-pkg as a function of
# the number of ld-options arguments.
set -eu
(cd ~/ghc-copy/Cabal/Cabal && cabal install --enable-library-profiling
--enable-executable-profiling --force-reinstalls --ghc-option=-rtsopts
--ghc-option=-prof --ghc-option=-fprof-auto)
(cd ~/ghc-copy/ghc/libraries/bin-package-db && cabal install --enable-
library-profiling --enable-executable-profiling --force-reinstalls --ghc-
option=-rtsopts --ghc-option=-prof --ghc-option=-fprof-auto)
(cd ~/ghc-copy/ghc/utils/ghc-pkg && cabal install --enable-library-
profiling --enable-executable-profiling --force-reinstalls --ghc-
option=-rtsopts --ghc-option=-prof --ghc-option=-fprof-auto --ghc-
option=-DBOOTSTRAPPING)
ghcpkg=~/.cabal/bin/ghc-pkg
for i in {13..13}; do
size=$((1 << $i))
echo $size
rm -fr a.packages
$ghcpkg init a.packages
cat > a.spec <