Skip to content

TTG Snags

Context

ImplementingTreesThatGrow

The intention is to get the first-pass implementation of Trees that Grow into GHC 8.4.1.

So far the following commits are on master

Unfortunately we have picked up compile-time performance regressions in compiling GHC itself, with these patches. The perf.haskell.org results are

Summary: each of the three patches caused GHC validate time to worsen by another 5% or so, cumulatively pushing compile time from 2011 to 2400 seconds.

It seems the major culprit is deriving the Data instances, probably related to the complex constraint sets required to ensure that all the extension points have Data instances too.

Some discussion around this is captured in ImplementingTreesThatGrow/Instances

Things tried so far

PLAN E (ImplementingTreesThatGrow/Instances#PLANE), in https://github.com/ghc/ghc/tree/wip/ttg5-data-one-file-2017-11-17.

This puts all the Data derivations for the hsSyn AST into a single file, hsSyn/HsInstances.hs.

This causes compile-time memory usage to spike up to around 7GB when compiling this file.

Gipedia reports a compilation time of 2468 secs for this version, which perhaps indicates that the instance derivation is not the main culprit. The module itself only takes in the order of 45secs to compile, on home.smart-cactus.org (http://lpaste.net/7779809210564345856)

Splitting the HsInstances.hs file in 2, as per https://github.com/ghc/ghc/tree/wip/ttg5-data-2017-11-17 reduces the memory requirement for each, but shows up #14482, where there is a linker failure due to incorrectly processing boot files.

Next Steps

I guess the first thing to do is to try to isolate what precisely is causing the slowdown. It may not be instance generation at all.

Also, it is probably better to revert the three patches from master, when cutting the 8.4 initial freeze.

Open to suggestions ...

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