[Haskell-cafe] How to benckmark a Word64 -> Bool?
alois.cochard at gmail.com
Wed Feb 19 19:21:07 UTC 2014
I had in mind comparing with similar tool the C version, but it looks like
I was a bit naive at thinking that same tooling exist for C (after googling
a bit it sounds there is no lib like that).
OTOH, Bryan O'Sullivan mention in his original blog past about criterion
that it could be potentially used to benchmark C code as well.
The cost of putting that in place might outperform the benefit though.
On 19 February 2014 18:49, Charles-Pierre Astolfi <cpa at crans.org> wrote:
> 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:
> $ ghc --make -O3 303only012.hs && time ./303only012 50000000 > /dev/null
> ./303only012 50000000 > /dev/null 9.72s user 0.21s system 90% cpu 10.961
> @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!
> 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:
>> 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
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe