[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Res: speed of Lua/LPeg parsers
- From: Sérgio Medeiros <tampo_8@...>
- Date: Mon, 13 Sep 2010 16:32:22 -0700 (PDT)
De: Duncan Cross <firstname.lastname@example.org>
Enviadas: Segunda-feira, 13 de Setembro de 2010 10:51:07
On Mon, Sep 13, 2010 at 2:35 PM, Roberto Ierusalimschy
>> Some time ago we implemented a simple JIT for LPeg. That JIT was
>> orders of magnitude simpler than LuaJIT, both because LPeg code
>> is much simpler than Lua code and because our JIT did not perform
>> any extra optimization: It uses a fixed translation for each LPeg
>> instruction. The end result was around three times faster than the
> Very interesting! I hadn't heard about this. Has the code ever been
> released? Even if there is some reason you don't feel it is
> production-ready, it sounds like an interesting thing to study.
We did not release the code of this project.
Last time I edited its source code was
about a year ago.
I put the source code of the project here:
The file lpeg.c has a function "generateprogram"
that translates the instruction of the LPEG VM to
The file test.lua is the test file that comes with
I developed most of the project in a Linux-32
environment. In this environment the
JIT compiled version of LPEG passed
all the tests in test.lua.
Unfortunately, some tests failed
in my Mac-64. I commented the tests
that failed (search for "TOFIX").