Opened 3 months ago

Last modified 10 days ago

#8731 new bug

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

Reported by: carter Owned by:
Priority: normal Milestone: 7.8.3
Component: Compiler Version: 7.8.1-rc1
Keywords: Cc: gideon@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time performance bug Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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

Attachments (1)

Constant.hs (4.4 KB) - added by carter 3 months ago.
data type example module

Download all attachments as: .zip

Change History (6)

Changed 3 months ago by carter

data type example module

comment:1 Changed 3 months ago by gidyn

  • Cc gideon@… added

comment:2 Changed 3 months ago by carter

rwbarton (on irc) noted this single module also has a nearly 1mb object file! Also apparently most of the code generated / time might be related to the Read and Show instances. (i've not check the latter myself, but sounds plausible)

comment:3 Changed 2 months ago by thoughtpolice

  • Milestone set to 7.8.2
  • Version 7.8.1-rc1 deleted

I'm punting this to 7.8.2.

comment:4 Changed 2 months ago by thoughtpolice

  • Version set to 7.8.1-rc1

comment:5 Changed 10 days ago by thoughtpolice

  • Milestone changed from 7.8.2 to 7.8.3
Note: See TracTickets for help on using tickets.