boxed FastTypes
Isaac Dupree
isaacdupree at charter.net
Fri Jan 4 13:18:35 EST 2008
Ian Lynagh wrote:
> On Thu, Jan 03, 2008 at 07:07:56AM -0500, Isaac Dupree wrote:
>> even have memory leaks. To partially remedy this, What if in data types
>> everywhere
>> data Foo = Foo FastInt
>> becomes
>> data Foo = Foo !FastInt
>> (the strictness annotation simply has no additional effect when FastInt
>> = Int# )
>> or even
>> data Foo = Foo {-#UNPACK#-}!FastInt
>
> Once this is done, it may be possible to go even further: If modern GHC
> can optimise code using Int to the same code that we would get if we
> used Int#, then it would be nice to de-hash as much of GHC's code as
> possible, and use the standard (+), (>) etc.
okay then, first step is the "safe" one of augmenting FastTypes,
removing nonportable unboxing from most of the code, and adding those
strictness annotations. I'm not going to have time to do more than a
very cursory inspection of varying performance, this time.
> We might need to give it a little help, e.g. using STRICT(x) in the odd
> pattern, where:
>
> #if __GLASGOW_HASKELL__ >= 608
> #define STRICT(x) !(x)
> #else
> #define STRICT(x) (x)
> #endif
sounds alright. (weren't bang-patterns introduced in GHC-6.6, so
__GLASGOW_HASKELL__ >= 606 ?)
~Isaac
More information about the Cvs-ghc
mailing list