Skip to content

long compilation time for module with large data type and partial record selectors

in both ghc 7.6 and 7.8rc, the Constants module in LLVM-General-Pure (and a few other similar modules) have surprisingly long (and noticable!) compilation times.

This seems to related to how GHC handles a many constructor data type with overlapping field names.

the time is nearly the same for building a static module with O1 and O2

carter repoScratcher/bad-ast » time ghc Constant.hs -O2                                                                      1 ↵
[1 of 1] Compiling Constant         ( Constant.hs, Constant.o )
ghc Constant.hs -O2  7.52s user 0.23s system 99% cpu 7.755 total
carter repoScratcher/bad-ast » time ghc Constant.hs -O1
[1 of 1] Compiling Constant         ( Constant.hs, Constant.o )
ghc Constant.hs -O1  6.62s user 0.20s system 100% cpu 6.768 total

heck even with -O0 its slow (though not terrible)

carter repoScratcher/bad-ast » time ghc Constant.hs -O0
[1 of 1] Compiling Constant         ( Constant.hs, Constant.o )
ghc Constant.hs -O0  2.76s user 0.14s system 101% cpu 2.873 total

Seems like there might something wrong in how we handle data types like this, the complexity need not

Trac metadata
Trac field Value
Version 7.8.1-rc1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information