[Haskell-cafe] How to benckmark a Word64 -> Bool?

Charles-Pierre Astolfi cpa at crans.org
Wed Feb 19 18:49:36 UTC 2014


Switching to quotRem gave no measurable improvements.
After switching to ByteString, the code now runs in 9 seconds, which
outperforms my C version. But honestly, I have no idea why.

New code:
http://lpaste.net/100136

$ ghc --make -O3 303only012.hs && time ./303only012 50000000 > /dev/null
./303only012 50000000 > /dev/null  9.72s user 0.21s system 90% cpu 10.961
total

@Alois, I'm not sure how criterion can help compare my code with the C
version, since in the C version I cannot measure the exec time of only012
only. What did you have in mind?

Thanks everyone!


--
Cp


On Wed, Feb 19, 2014 at 7:24 PM, Levent Erkok <erkokl at gmail.com> wrote:

> Also, prefer quotRem over divMod as the former is faster. See here:
> http://stackoverflow.com/questions/339719/when-is-the-difference-between-quotrem-and-divmod-useful
>
>
> On Wed, Feb 19, 2014 at 10:19 AM, Gregory Collins <greg at gregorycollins.net
> > wrote:
>
>>
>> On Wed, Feb 19, 2014 at 9:36 AM, Charles-Pierre Astolfi <cpa at crans.org>wrote:
>>
>>> So there's a difference, but I'm not sure if it's related to my
>>> algorithm or related to IO/RTS.
>>
>>
>> Text.Printf is slower than the C version (and uses String). Use
>> Data.ByteString.putStr instead.
>>
>>
>> --
>> Gregory Collins <greg at gregorycollins.net>
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140219/1b53ad99/attachment.html>


More information about the Haskell-Cafe mailing list