[Haskell-cafe] ANN: cheapskate 0.1, markdown parser

Daniil Frumin difrumin at gmail.com
Wed Jan 8 01:45:47 UTC 2014


Cool!

By the way, I've noticed that you've rolled your own parser combinator
library. May I ask you, what is the reason for that?
Are other parser libraries not fast enough for the needs?

Thanks

On Mon, Jan 6, 2014 at 11:15 PM, John MacFarlane <jgm at berkeley.edu> wrote:
> I've released a new markdown library on Hackage:
> http://hackage.haskell.org/package/cheapskate
>
> This library is designed to be used in web applications.  It is small,
> accurate, and fast, in pure Haskell with few dependencies.  All output
> is sanitized through a whitelist by default.  It is designed to have
> performance that varies linearly with the input size, even with garbage
> input.  To illustrate:
>
> % head -c 100000 /dev/urandom | iconv -f latin1 -t utf-8 | time cheapskate >/dev/null
> cheapskate > /dev/null  0.15s user 0.01s system 82% cpu 0.199 total
> % head -c 1000000 /dev/urandom | iconv -f latin1 -t utf-8 | time cheapskate >/dev/null
> cheapskate > /dev/null  1.53s user 0.03s system 88% cpu 1.770 total
> % head -c 10000000 /dev/urandom | iconv -f latin1 -t utf-8 | time cheapskate >/dev/null
> cheapskate > /dev/null  15.50s user 0.20s system 89% cpu 17.632 total
>
> This is a test that many markdown parsers fail (including my own pandoc
> and the markdown package on Hackage).
>
> Performance is about seven times faster than pandoc (with five times
> less memory used), and about 25% faster than the markdown package on Hackage.
>
> Generic functions are provided that allow transformations of the AST
> prior to rendering (e.g., promotion of headers, insertion of syntax
> highlighting, or the conversion of specially marked code blocks into
> diagrams).
>
> Several markdown extensions are supported, and sensible decisions have
> been made about several aspects of markdown syntax that are left vague
> by John Gruber's specification.  For details, see the README
> at https://github.com/jgm/cheapskate.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



-- 
Sincerely yours,
-- Daniil


More information about the Haskell-Cafe mailing list