[GHC] #8766: length [Integer] is twice as slow but length [Int] is 10 times faster
GHC
ghc-devs at haskell.org
Tue Feb 11 11:14:55 UTC 2014
#8766: length [Integer] is twice as slow but length [Int] is 10 times faster
--------------------------------------------+------------------------------
Reporter: George | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.1-rc1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime performance bug | Unknown/Multiple
Test Case: | Difficulty: Unknown
Blocking: | Blocked By:
| Related Tickets:
--------------------------------------------+------------------------------
Comment (by hvr):
Replying to [comment:2 nomeata]:
> The improvement for `Int` is most likely from 82f56e5 (#876). But I
guess the important point of the ticket is the regression for `Integer`.
I was getting to that (needed to verify something first though):
The Core for
{{{#!hs
intlen = length [1..(2^(30::Int))::Integer]
}}}
Otoh, looks differs as following:
GHC 7.6.3:
{{{
intlen1 = enumDeltaToInteger intlen3 intlen3 intlen2
}}}
vs.
GHC 7.8.20140130:
{{{
intlen1 = enumDeltaToIntegerFB (incLen) I# intlen3 intlen3 intlen2
}}}
The use of `enumDeltaToIntegerFB` instead of `enumDeltaToInteger` accounts
for the speed difference. I've verified that by copying the definition
from `GHC.Enum` into the test-code and using `enumDeltaToInteger` directly
with GHC 7.8.20140130 which resulted in a slightly better runtime than for
GHC 7.6.3
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8766#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list