[Haskell-beginners] Integer performance of GHC
Sebastián E. Peyrott
pseus7 at gmail.com
Sat Aug 7 19:42:31 EDT 2010
I just tried the LLVM code generator from GHC HEAD. I must say I am
impressed. Now my simple MD5 is just 1.8 times slower, rather 2.77.
Still not as efficient as I would like, but hey...
I'll have a look at the generated assembly.
2010/8/7 Sebastián E. Peyrott <pseus7 at gmail.com>:
> Thanks for the links. I had already seen Don's post, but I have yet to
> try the LLVM backend. I'll do so as soon as a stable GHC version with
> it is out.
> The Haskell math performance link is interesting. If I'm not mistaken,
> the OP achieved C levels of performance by switching to Data.Vector
> and keeping data structures as close to C as possible. That seems
> reasonable. However, for the example I gave earlier (an MD5
> implementation), I don't see a way to use Data.Vector. The algorithm
> performs repeated operations on 4 32-bit integers and that's it. The
> implementation in Happstack is as close to C as possible, yet it's
> still slower. My own too.
> I've been trying to read the generated Core and assembly but I don't
> really have any experience doing that. I can see most fields are
> unboxed and inlining appears to be working. I see repeated calls to
> GHC.Prim.narrow32Word# too. In the generated assembly I see many
> operations with literal '$4294967295'. Could that be the culprit?
> I have uploaded the generated Core for the main MD5 computation
> (RFC1321, section 3.4) here: http://pastebin.com/e51njdcS
> The actual computation starts at line 1507. Please note this is not
> from the version in Happstack but rather from my own. You can find
> RFC1321 here: http://tools.ietf.org/html/rfc1321
> If you feel talking about Core and assembly is perhaps not suitable
> for Haskell-beginners, I'll move this discussion to Haskell-cafe.
> 2010/8/7 David Virebayre <dav.vire+haskell at gmail.com>:
>> 2010/8/7 Sebastián E. Peyrott <pseus7 at gmail.com>:
>>> Hi, I'm looking for information on Haskell's viability for heavy
>>> integer math. My (very) naive tests show Haskell lagging behind C even
>> Relevant links :
>> Benefits of the LLVM code generator (lots of other relevant posts on Dons' blog)
>> Archive of threads about loop unrolling :
>> (Also check some of the links in "You might also be interested in:")
More information about the Beginners