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

Justin Bailey jgbailey at gmail.com
Mon Jan 6 21:07:35 UTC 2014


Looks like an excellent library! How did you manage to maintain linear
growth in running time? Seems like quite an achievement.

On Mon, Jan 6, 2014 at 11:15 AM, 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


More information about the Haskell-Cafe mailing list