Evan Martin (evan) wrote in evan_tech,
Evan Martin
evan
evan_tech

hexpat microbenchmarking

There was this thread on Reddit about my release of those Expat bindings. They were, in fact, motivated by speed. I wrote a little microbenchmarking library and found that for the particular file formats I care about, Expat is an order of magnitude faster compared to HaXml:
$ ./perf
input is 325709 bytes.
* HaXml: ...
3.06 per second.
* hexpat: .......
37.31 per second.

[Updated: using ByteStrings brought this up to around 42 on my machine...]

(These comparisons, are, of course, not at all fair; HaXml provides a lot more functionality and a DOM-like API. But for my project I don't care about all that. I just want it to be fast.)

I spent quite a while trying to figure out how to get GHC to re-run a pure function (for benchmarking purposes) and eventually gave up. It seems you can make it work sometimes but the optimizer likes to say "oh, we already computed that". It seems there ought to be some pragma related to this but I couldn't figure it out.
Tags: haskell, project
Subscribe

  • your vcs sucks

    I've been hacking on some Haskell stuff lately that's all managed in darcs and it's reminded me of an observation I made over two years ago now (see…

  • ghc llvm

    I read this thesis on an LLVM backend for GHC, primarily because I was curious to learn more about GHC internals. The thesis serves well as an…

  • found my bug!

    Not too interesting, but this has been bugging me for a week. Been working on a toy program that proxies a TCP connection. It was working fine for…

  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments