[GHC] #2289: Needless reboxing of values when returning from a
tight loop
GHC
trac at galois.com
Sat May 17 17:06:21 EDT 2008
#2289: Needless reboxing of values when returning from a tight loop
-------------------------------------------+--------------------------------
Reporter: dons | Owner:
Type: run-time performance bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.8.2
Severity: normal | Resolution:
Keywords: boxing, loops, performance | Testcase:
Architecture: Unknown | Os: Unknown
-------------------------------------------+--------------------------------
Comment (by dons):
Note that if we specialise the constructor manually, we can get the
correct unboxing:
That is, just using strict pairs isn't enough:
{{{
data P a b = P {-# UNPACK #-} !a {-# UNPACK #-} !b
}}}
won't work.
where we use P only for P Double Int, I'm unable to get the return value
unboxed.
If we specialise P, data P = P !Double !Int, then we do get the unpacking,
as expected.
This makes strict pairs a little less useful for accumulating state -- we
have to specialise them
directly ourselves to avoid the reboxing penalty.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2289#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list