Sunday, May 4, 2008

character vs. token based parser in Parsec with haskell

Ok, the first parser did look *ugly*, so I wrote a bit less ugly one, using the token parser. It's not much shorter,
but runs two times faster!


$ time ./packet_template_token >/dev/null

real 0m0.138s
user 0m0.130s
sys 0m0.006s
$ time ./packet_template_char >/dev/null

real 0m0.395s
user 0m0.388s
sys 0m0.005s
$



In case you are interested, both are here

No comments: