[GHC] #14974: 2-fold memory usage regression GHC 8.2.2 -> GHC 8.4.1 compiling `mmark` package

GHC ghc-devs at haskell.org
Mon Mar 26 15:53:17 UTC 2018


#14974: 2-fold memory usage regression GHC 8.2.2 -> GHC 8.4.1 compiling `mmark`
package
-------------------------------------+-------------------------------------
        Reporter:  hvr               |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:
       Component:  Compiler          |              Version:  8.4.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by bgamari:

Old description:

> I haven't had time yet to diagnose where the memory is going to, but
> here's how to reproduce:
>
> {{{
> cabal get mmark-0.0.5.6 && cd mmark-0.0.5.6/
>
> cat > cabal.project <<EOF
> packages: .
> package mmark
>   ghc-options: -Rghc-timing
> EOF
> }}}
>
> Then, `cabal new-build -w ghc-8.4.1` and ``cabal new-build -w ghc-8.2.2`
> will respectively output
>
> {{{
> Resolving dependencies...
> Build profile: -w ghc-8.4.1 -O1
> In order, the following will be built (use -v for more details):
>  - mmark-0.0.5.6 (lib) (first run)
> Configuring library for mmark-0.0.5.6..
> <<ghc: 13510872 bytes, 13 GCs, 806197/1299656 avg/max bytes residency (3
> samples), 4M in use, 0.001 INIT (0.000 elapsed), 0.007 MUT (0.025
> elapsed), 0.018 GC (0.018 elapsed) :ghc>>
> Preprocessing library for mmark-0.0.5.6..
> Building library for mmark-0.0.5.6..
> [1 of 9] Compiling Text.MMark.Parser.Internal.Type (
> Text/MMark/Parser/Internal/Type.hs, /tmp/mmark-0.0.5.6/dist-
> newstyle/build/x86_64-linux/ghc-8.4.1/mmark-0.0.5.6/build/Text/MMark/Parser/Internal/Type.o
> )
> [2 of 9] Compiling Text.MMark.Parser.Internal (
> Text/MMark/Parser/Internal.hs, /tmp/mmark-0.0.5.6/dist-
> newstyle/build/x86_64-linux/ghc-8.4.1/mmark-0.0.5.6/build/Text/MMark/Parser/Internal.o
> )
> [3 of 9] Compiling Text.MMark.Type  ( Text/MMark/Type.hs,
> /tmp/mmark-0.0.5.6/dist-
> newstyle/build/x86_64-linux/ghc-8.4.1/mmark-0.0.5.6/build/Text/MMark/Type.o
> )
> [4 of 9] Compiling Text.MMark.Trans ( Text/MMark/Trans.hs,
> /tmp/mmark-0.0.5.6/dist-
> newstyle/build/x86_64-linux/ghc-8.4.1/mmark-0.0.5.6/build/Text/MMark/Trans.o
> )
> [5 of 9] Compiling Text.MMark.Util  ( Text/MMark/Util.hs,
> /tmp/mmark-0.0.5.6/dist-
> newstyle/build/x86_64-linux/ghc-8.4.1/mmark-0.0.5.6/build/Text/MMark/Util.o
> )
> [6 of 9] Compiling Text.MMark.Render ( Text/MMark/Render.hs,
> /tmp/mmark-0.0.5.6/dist-
> newstyle/build/x86_64-linux/ghc-8.4.1/mmark-0.0.5.6/build/Text/MMark/Render.o
> )
> [7 of 9] Compiling Text.MMark.Parser ( Text/MMark/Parser.hs,
> /tmp/mmark-0.0.5.6/dist-
> newstyle/build/x86_64-linux/ghc-8.4.1/mmark-0.0.5.6/build/Text/MMark/Parser.o
> )
> [8 of 9] Compiling Text.MMark       ( Text/MMark.hs, /tmp/mmark-0.0.5.6
> /dist-
> newstyle/build/x86_64-linux/ghc-8.4.1/mmark-0.0.5.6/build/Text/MMark.o )
> [9 of 9] Compiling Text.MMark.Extension ( Text/MMark/Extension.hs,
> /tmp/mmark-0.0.5.6/dist-
> newstyle/build/x86_64-linux/ghc-8.4.1/mmark-0.0.5.6/build/Text/MMark/Extension.o
> )
> <<ghc: 89663269464 bytes, 1856 GCs, 338140365/1430147624 avg/max bytes
> residency (23 samples), 4130M in use, 0.000 INIT (0.000 elapsed), 58.546
> MUT (62.124 elapsed), 31.536 GC (31.505 elapsed) :ghc>>
> <<ghc: 65387008 bytes, 50 GCs, 2189716/5047200 avg/max bytes residency (5
> samples), 11M in use, 0.000 INIT (0.000 elapsed), 0.021 MUT (0.207
> elapsed), 0.042 GC (0.042 elapsed) :ghc>>
> }}}
>
> and
>
> {{{
> Resolving dependencies...
> Build profile: -w ghc-8.2.2 -O1
> In order, the following will be built (use -v for more details):
>  - mmark-0.0.5.6 (lib) (first run)
> Configuring library for mmark-0.0.5.6..
> <<ghc: 11200976 bytes, 11 GCs, 853349/1518976 avg/max bytes residency (3
> samples), 5M in use, 0.001 INIT (0.000 elapsed), 0.017 MUT (0.037
> elapsed), 0.021 GC (0.021 elapsed) :ghc>>
> Preprocessing library for mmark-0.0.5.6..
> Building library for mmark-0.0.5.6..
> [1 of 9] Compiling Text.MMark.Parser.Internal.Type (
> Text/MMark/Parser/Internal/Type.hs, /tmp/mmark-0.0.5.6/dist-
> newstyle/build/x86_64-linux/ghc-8.2.2/mmark-0.0.5.6/build/Text/MMark/Parser/Internal/Type.o
> )
> [2 of 9] Compiling Text.MMark.Parser.Internal (
> Text/MMark/Parser/Internal.hs, /tmp/mmark-0.0.5.6/dist-
> newstyle/build/x86_64-linux/ghc-8.2.2/mmark-0.0.5.6/build/Text/MMark/Parser/Internal.o
> )
> [3 of 9] Compiling Text.MMark.Type  ( Text/MMark/Type.hs,
> /tmp/mmark-0.0.5.6/dist-
> newstyle/build/x86_64-linux/ghc-8.2.2/mmark-0.0.5.6/build/Text/MMark/Type.o
> )
> [4 of 9] Compiling Text.MMark.Trans ( Text/MMark/Trans.hs,
> /tmp/mmark-0.0.5.6/dist-
> newstyle/build/x86_64-linux/ghc-8.2.2/mmark-0.0.5.6/build/Text/MMark/Trans.o
> )
> [5 of 9] Compiling Text.MMark.Util  ( Text/MMark/Util.hs,
> /tmp/mmark-0.0.5.6/dist-
> newstyle/build/x86_64-linux/ghc-8.2.2/mmark-0.0.5.6/build/Text/MMark/Util.o
> )
> [6 of 9] Compiling Text.MMark.Render ( Text/MMark/Render.hs,
> /tmp/mmark-0.0.5.6/dist-
> newstyle/build/x86_64-linux/ghc-8.2.2/mmark-0.0.5.6/build/Text/MMark/Render.o
> )
> [7 of 9] Compiling Text.MMark.Parser ( Text/MMark/Parser.hs,
> /tmp/mmark-0.0.5.6/dist-
> newstyle/build/x86_64-linux/ghc-8.2.2/mmark-0.0.5.6/build/Text/MMark/Parser.o
> )
> [8 of 9] Compiling Text.MMark       ( Text/MMark.hs, /tmp/mmark-0.0.5.6
> /dist-
> newstyle/build/x86_64-linux/ghc-8.2.2/mmark-0.0.5.6/build/Text/MMark.o )
> [9 of 9] Compiling Text.MMark.Extension ( Text/MMark/Extension.hs,
> /tmp/mmark-0.0.5.6/dist-
> newstyle/build/x86_64-linux/ghc-8.2.2/mmark-0.0.5.6/build/Text/MMark/Extension.o
> )
> <<ghc: 89565902800 bytes, 2004 GCs, 225836231/772393000 avg/max bytes
> residency (27 samples), 2179M in use, 0.001 INIT (0.000 elapsed), 58.237
> MUT (61.472 elapsed), 25.823 GC (25.795 elapsed) :ghc>>
> <<ghc: 79930048 bytes, 56 GCs, 3522920/10072040 avg/max bytes residency
> (6 samples), 20M in use, 0.001 INIT (0.000 elapsed), 0.028 MUT (0.213
> elapsed), 0.059 GC (0.059 elapsed) :ghc>>
> }}}
>

>
> Consequently,
>
>  - GHC 8.2.2: **2179M in use**, 0.001 INIT (0.000 elapsed), 58.237 MUT
> (61.472 elapsed), 25.823 GC (25.795 elapsed)
>
>  - GHC 8.4.1: **4130M in use**, 0.000 INIT (0.000 elapsed), 58.546 MUT
> (62.124 elapsed), 31.536 GC (31.505 elapsed)

New description:

 I haven't had time yet to diagnose where the memory is going to, but
 here's how to reproduce:

 {{{
 cabal get mmark-0.0.5.6 && cd mmark-0.0.5.6/

 cat > cabal.project <<EOF
 packages: .
 package mmark
   ghc-options: -Rghc-timing
 EOF
 }}}

 Then, `cabal new-build -w ghc-8.4.1` and `cabal new-build -w ghc-8.2.2`
 will respectively output

 {{{
 Resolving dependencies...
 Build profile: -w ghc-8.4.1 -O1
 In order, the following will be built (use -v for more details):
  - mmark-0.0.5.6 (lib) (first run)
 Configuring library for mmark-0.0.5.6..
 <<ghc: 13510872 bytes, 13 GCs, 806197/1299656 avg/max bytes residency (3
 samples), 4M in use, 0.001 INIT (0.000 elapsed), 0.007 MUT (0.025
 elapsed), 0.018 GC (0.018 elapsed) :ghc>>
 Preprocessing library for mmark-0.0.5.6..
 Building library for mmark-0.0.5.6..
 [1 of 9] Compiling Text.MMark.Parser.Internal.Type (
 Text/MMark/Parser/Internal/Type.hs, /tmp/mmark-0.0.5.6/dist-
 newstyle/build/x86_64-linux/ghc-8.4.1/mmark-0.0.5.6/build/Text/MMark/Parser/Internal/Type.o
 )
 [2 of 9] Compiling Text.MMark.Parser.Internal (
 Text/MMark/Parser/Internal.hs, /tmp/mmark-0.0.5.6/dist-
 newstyle/build/x86_64-linux/ghc-8.4.1/mmark-0.0.5.6/build/Text/MMark/Parser/Internal.o
 )
 [3 of 9] Compiling Text.MMark.Type  ( Text/MMark/Type.hs,
 /tmp/mmark-0.0.5.6/dist-
 newstyle/build/x86_64-linux/ghc-8.4.1/mmark-0.0.5.6/build/Text/MMark/Type.o
 )
 [4 of 9] Compiling Text.MMark.Trans ( Text/MMark/Trans.hs,
 /tmp/mmark-0.0.5.6/dist-
 newstyle/build/x86_64-linux/ghc-8.4.1/mmark-0.0.5.6/build/Text/MMark/Trans.o
 )
 [5 of 9] Compiling Text.MMark.Util  ( Text/MMark/Util.hs,
 /tmp/mmark-0.0.5.6/dist-
 newstyle/build/x86_64-linux/ghc-8.4.1/mmark-0.0.5.6/build/Text/MMark/Util.o
 )
 [6 of 9] Compiling Text.MMark.Render ( Text/MMark/Render.hs,
 /tmp/mmark-0.0.5.6/dist-
 newstyle/build/x86_64-linux/ghc-8.4.1/mmark-0.0.5.6/build/Text/MMark/Render.o
 )
 [7 of 9] Compiling Text.MMark.Parser ( Text/MMark/Parser.hs,
 /tmp/mmark-0.0.5.6/dist-
 newstyle/build/x86_64-linux/ghc-8.4.1/mmark-0.0.5.6/build/Text/MMark/Parser.o
 )
 [8 of 9] Compiling Text.MMark       ( Text/MMark.hs, /tmp/mmark-0.0.5.6
 /dist-
 newstyle/build/x86_64-linux/ghc-8.4.1/mmark-0.0.5.6/build/Text/MMark.o )
 [9 of 9] Compiling Text.MMark.Extension ( Text/MMark/Extension.hs,
 /tmp/mmark-0.0.5.6/dist-
 newstyle/build/x86_64-linux/ghc-8.4.1/mmark-0.0.5.6/build/Text/MMark/Extension.o
 )
 <<ghc: 89663269464 bytes, 1856 GCs, 338140365/1430147624 avg/max bytes
 residency (23 samples), 4130M in use, 0.000 INIT (0.000 elapsed), 58.546
 MUT (62.124 elapsed), 31.536 GC (31.505 elapsed) :ghc>>
 <<ghc: 65387008 bytes, 50 GCs, 2189716/5047200 avg/max bytes residency (5
 samples), 11M in use, 0.000 INIT (0.000 elapsed), 0.021 MUT (0.207
 elapsed), 0.042 GC (0.042 elapsed) :ghc>>
 }}}

 and

 {{{
 Resolving dependencies...
 Build profile: -w ghc-8.2.2 -O1
 In order, the following will be built (use -v for more details):
  - mmark-0.0.5.6 (lib) (first run)
 Configuring library for mmark-0.0.5.6..
 <<ghc: 11200976 bytes, 11 GCs, 853349/1518976 avg/max bytes residency (3
 samples), 5M in use, 0.001 INIT (0.000 elapsed), 0.017 MUT (0.037
 elapsed), 0.021 GC (0.021 elapsed) :ghc>>
 Preprocessing library for mmark-0.0.5.6..
 Building library for mmark-0.0.5.6..
 [1 of 9] Compiling Text.MMark.Parser.Internal.Type (
 Text/MMark/Parser/Internal/Type.hs, /tmp/mmark-0.0.5.6/dist-
 newstyle/build/x86_64-linux/ghc-8.2.2/mmark-0.0.5.6/build/Text/MMark/Parser/Internal/Type.o
 )
 [2 of 9] Compiling Text.MMark.Parser.Internal (
 Text/MMark/Parser/Internal.hs, /tmp/mmark-0.0.5.6/dist-
 newstyle/build/x86_64-linux/ghc-8.2.2/mmark-0.0.5.6/build/Text/MMark/Parser/Internal.o
 )
 [3 of 9] Compiling Text.MMark.Type  ( Text/MMark/Type.hs,
 /tmp/mmark-0.0.5.6/dist-
 newstyle/build/x86_64-linux/ghc-8.2.2/mmark-0.0.5.6/build/Text/MMark/Type.o
 )
 [4 of 9] Compiling Text.MMark.Trans ( Text/MMark/Trans.hs,
 /tmp/mmark-0.0.5.6/dist-
 newstyle/build/x86_64-linux/ghc-8.2.2/mmark-0.0.5.6/build/Text/MMark/Trans.o
 )
 [5 of 9] Compiling Text.MMark.Util  ( Text/MMark/Util.hs,
 /tmp/mmark-0.0.5.6/dist-
 newstyle/build/x86_64-linux/ghc-8.2.2/mmark-0.0.5.6/build/Text/MMark/Util.o
 )
 [6 of 9] Compiling Text.MMark.Render ( Text/MMark/Render.hs,
 /tmp/mmark-0.0.5.6/dist-
 newstyle/build/x86_64-linux/ghc-8.2.2/mmark-0.0.5.6/build/Text/MMark/Render.o
 )
 [7 of 9] Compiling Text.MMark.Parser ( Text/MMark/Parser.hs,
 /tmp/mmark-0.0.5.6/dist-
 newstyle/build/x86_64-linux/ghc-8.2.2/mmark-0.0.5.6/build/Text/MMark/Parser.o
 )
 [8 of 9] Compiling Text.MMark       ( Text/MMark.hs, /tmp/mmark-0.0.5.6
 /dist-
 newstyle/build/x86_64-linux/ghc-8.2.2/mmark-0.0.5.6/build/Text/MMark.o )
 [9 of 9] Compiling Text.MMark.Extension ( Text/MMark/Extension.hs,
 /tmp/mmark-0.0.5.6/dist-
 newstyle/build/x86_64-linux/ghc-8.2.2/mmark-0.0.5.6/build/Text/MMark/Extension.o
 )
 <<ghc: 89565902800 bytes, 2004 GCs, 225836231/772393000 avg/max bytes
 residency (27 samples), 2179M in use, 0.001 INIT (0.000 elapsed), 58.237
 MUT (61.472 elapsed), 25.823 GC (25.795 elapsed) :ghc>>
 <<ghc: 79930048 bytes, 56 GCs, 3522920/10072040 avg/max bytes residency (6
 samples), 20M in use, 0.001 INIT (0.000 elapsed), 0.028 MUT (0.213
 elapsed), 0.059 GC (0.059 elapsed) :ghc>>
 }}}



 Consequently,

  - GHC 8.2.2: **2179M in use**, 0.001 INIT (0.000 elapsed), 58.237 MUT
 (61.472 elapsed), 25.823 GC (25.795 elapsed)

  - GHC 8.4.1: **4130M in use**, 0.000 INIT (0.000 elapsed), 58.546 MUT
 (62.124 elapsed), 31.536 GC (31.505 elapsed)

--

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


More information about the ghc-tickets mailing list