Adding an explicit export list halves compilation time.
A file only containing a 10000 constructor enumeration type compiles twice as fast with an explicit export list compare to having no export list.
# print "module A where"
print "module A (T ( .. ) ) where"
print "\n"
print "data T = C"
for i in range(0,10000):
print (" | C" + str(i))
Without an export list:
[1 of 1] Compiling A ( A.hs, A.o )
real 0m22.872s
user 0m19.653s
sys 0m0.868s
With the export list:
[1 of 1] Compiling A ( A.hs, A.o )
real 0m11.249s
user 0m10.428s
sys 0m0.435s
The culprit here is exports_from_avail, in the case that no export list is provided, the things to export
are gathered from the GlobalRdrEnv. Each constructor is placed in its own Avail which are then combined by plusAvail which is implemented using the expensive unionLists.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |