Skip to content

Compiled code performance worsens when module names are long enough

Attached to this report is an example where by simply renaming a module, performance degrades 2.5 times.

#diff long-modname-ver.hs short-modname-ver.hs
2c2
< import VeryLongModuleName
---
> import ShortM

#diff VeryLongModuleName.hs ShortM.hs
1c1
< module VeryLongModuleName
---
> module ShortM

#ghc --make -O2 -Wall long-modname-ver.hs

#ghc --make -O2 -Wall short-modname-ver.hs

#time -p ./long-modname-ver > /dev/null
real 55.90
user 55.17
sys 0.51

#time -p ./short-modname-ver > /dev/null
real 22.23
user 21.97
sys 0.10

According to some measures by dons, the threshold seems to be at module length 10 (see attached graph).

Some further disussion on this thread http://thread.gmane.org/gmane.comp.lang.haskell.glasgow.user/16037.

Trac metadata
Trac field Value
Version 6.10.1
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