[GHC] #9885: ghc-pkg parser eats too much memory

GHC ghc-devs at haskell.org
Sun Dec 14 22:15:54 UTC 2014


#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 <<EOF
 name: project
 id: project
 license: AllRightsReserved
 version: 1.0
 EOF
   echo -n ld-options: >> a.spec
   for i in $(seq 1 $size); do echo -n "x "; done >> a.spec
    rm -f ghc-pkg.{hp,ps}
    /usr/bin/time $ghcpkg -v2 --global-package-db a.packages register
 --force a.spec +RTS -hc -L100 || true
    hp2ps -b -c ghc-pkg.hp
    evince ghc-pkg.ps
 done

 }}}

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


More information about the ghc-tickets mailing list