Re: Efficient string parsing

  • From: Craig Barnes <craigbarnes85@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 24 Oct 2012 10:32:34 +0100

On 24 October 2012 07:47, M. Edward (Ed) Borasky <znmeb@xxxxxxxxx> wrote:
>
> If you *must* work with Markdown, Pandoc is fairly good, although it's
> written in Haskell and requires a huge chunk of Haskell packages at
> run time. But you're right - Markdown is a time sink at best and it
> inhibits you from learning HTML5.
>

I disagree. The advantages are only subtle, but they start
to matter to someone who already knows HTML5 and
spends a lot of time each day working with it.

On 23 October 2012 23:15, Wolfgang Pupp <wolfgang.pupp@xxxxxxxxx> wrote:
> Hello list,
>
> I'm about to implement a simple parser in LuaJIT, and now considering
> on the best approach.
> The target language is somewhat similar to Lua, but more of a
> data-description-thingy (no loops, no conditionals).
> The input chunks will probably always remain <10k lines (much, much
> lower most of the time)- but there's gonna be a lot of them.
>
> Design criteria are:
>  - No dependencies on dynamically linked libraries/C- code (ffi-usage
> should be optional, at most)
>  - Not too complicated
>  - As fast as possible

I recommend Lunamark[1]. It's not the absolute fastest, but it's
plenty fast enough and it has some very useful extensions and
extra features. There are some painfully slow implementations
of Markdown out there but Lunamark certainly isn't one of them.

According to the benchmarks in the Lunamark docs, Sundown and
Discount are the fastest Markdown parsers. If you really want
absolute speed you might be interested in [2] and [3].

[1]: http://jgm.github.com/lunamark/
[2]: https://github.com/craigbarnes/lua-discount
[3] https://github.com/craigbarnes/lua-sundown

Other related posts: