Skip to content

Demonstrates compilation problem with GHC 9.8

Notifications You must be signed in to change notification settings

m4dc4p/ghc98-bug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

This repo demonstrates pathological compilation behavior with GHC 9.8 & some higher-kinded types.

I've imported all files for barbies and some dependencies so the problem can be reproduced w/o cabal or 
other packages.

To see the problem, use `ghc --make`:

```
ghc -O1 \
     --make \
     -XHaskell2010 \
     -XUndecidableInstances \
     -XMultiParamTypeClasses \
     -XTypeOperators \
     -XFlexibleInstances \
     -XLambdaCase \
     -XRankNTypes \
     -XTypeApplications \
     -XDefaultSignatures \
     -XDataKinds \
     -XConstraintKinds \
     -XFlexibleContexts \
     -XScopedTypeVariables \
     -XEmptyCase \
     -XDeriveGeneric \
     -XStandaloneDeriving \
     -XDeriveDataTypeable \
     -isrc \
     src/GHC98/AAAX.hs
```

The file AAAX.hs will take longer and longer to compile as you uncomment fields on the HDKType record.

Timings below captured on Mac M2 w/ MacOS 14.2.1 (Sonoma)

## GHC 9.8
* 1 field

```
        2.45 real         1.76 user         0.32 sys
           198443008  maximum resident set size
                   0  average shared memory size
                   0  average unshared data size
                   0  average unshared stack size
              123197  page reclaims
                 861  page faults
                   0  swaps
                   0  block input operations
                   0  block output operations
                   2  messages sent
                   0  messages received
                   0  signals received
                  38  voluntary context switches
                3116  involuntary context switches
          9814386648  instructions retired
          2612313406  cycles elapsed
           168805760  peak memory footprint
```

* 2 fields

```
	6.92s real		6.10s user		0.39s sys
          1067794432  maximum resident set size
                   0  average shared memory size
                   0  average unshared data size
                   0  average unshared stack size
              179793  page reclaims
                 861  page faults
                   0  swaps
                   0  block input operations
                   0  block output operations
                   2  messages sent
                   0  messages received
                   0  signals received
                  44  voluntary context switches
                3706  involuntary context switches
          9838375536  instructions retired
          2550883719  cycles elapsed
           169166208  peak memory footprint
```

* 3 fields

```
       26.75 real        24.71 user         0.64 sys
          4637196288  maximum resident set size
                   0  average shared memory size
                   0  average unshared data size
                   0  average unshared stack size
              397622  page reclaims
                 861  page faults
                   0  swaps
                   0  block input operations
                   0  block output operations
                   2  messages sent
                   0  messages received
                   0  signals received
                  75  voluntary context switches
                5274  involuntary context switches
          9841577386  instructions retired
          2636315677  cycles elapsed
           169051584  peak memory footprint
```

* 4 fields

```
       82.89 real        74.09 user         3.68 sys
         14566916096  maximum resident set size
                   0  average shared memory size
                   0  average unshared data size
                   0  average unshared stack size
             1906927  page reclaims
                  87  page faults
                   0  swaps
                   0  block input operations
                   0  block output operations
                   0  messages sent
                   0  messages received
                  34  signals received
                1210  voluntary context switches
               16583  involuntary context switches
          9911790542  instructions retired
          2987773427  cycles elapsed
           172803584  peak memory footprint
```

## GHC 9.6

* 1 field

```
        2.69 real         1.82 user         0.45 sys
           201392128  maximum resident set size
                   0  average shared memory size
                   0  average unshared data size
                   0  average unshared stack size
              182809  page reclaims
                   9  page faults
                   0  swaps
                   0  block input operations
                   0  block output operations
                   0  messages sent
                   0  messages received
                  10  signals received
                 130  voluntary context switches
                2174  involuntary context switches
          8946246041  instructions retired
          2487480907  cycles elapsed
           172656064  peak memory footprint
```

* 2 fields

```
        2.77 real         1.86 user         0.47 sys
           196116480  maximum resident set size
                   0  average shared memory size
                   0  average unshared data size
                   0  average unshared stack size
              182679  page reclaims
                   9  page faults
                   0  swaps
                   0  block input operations
                   0  block output operations
                   0  messages sent
                   0  messages received
                   4  signals received
                 131  voluntary context switches
                2407  involuntary context switches
          8834557551  instructions retired
          2463125862  cycles elapsed
           167380416  peak memory footprint
```

* 3 fields

```
        2.77 real         1.88 user         0.44 sys
           201113600  maximum resident set size
                   0  average shared memory size
                   0  average unshared data size
                   0  average unshared stack size
              182326  page reclaims
                   9  page faults
                   0  swaps
                   0  block input operations
                   0  block output operations
                   0  messages sent
                   0  messages received
                  10  signals received
                 124  voluntary context switches
                2349  involuntary context switches
          8947906381  instructions retired
          2506402265  cycles elapsed
           172361088  peak memory footprint
```

* 10 fields

```
        3.04 real         2.13 user         0.45 sys
           246398976  maximum resident set size
                   0  average shared memory size
                   0  average unshared data size
                   0  average unshared stack size
              186636  page reclaims
                   9  page faults
                   0  swaps
                   0  block input operations
                   0  block output operations
                   0  messages sent
                   0  messages received
                  15  signals received
                 119  voluntary context switches
                2427  involuntary context switches
          9351551465  instructions retired
          2749329243  cycles elapsed
           217679360  peak memory footprint
```

About

Demonstrates compilation problem with GHC 9.8

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published