[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: speed of Lua/LPeg parsers
- From: Duncan Cross <duncan.cross@...>
- Date: Tue, 14 Sep 2010 18:02:35 +0100
2010/9/14 Sérgio Medeiros <tampo_8@yahoo.com>:
> De: Duncan Cross <duncan.cross@gmail.com>
>
> Enviadas: Segunda-feira, 13 de Setembro de 2010 10:51:07
>
> On Mon, Sep 13, 2010 at 2:35 PM, Roberto Ierusalimschy
> <roberto@inf.puc-rio.br> wrote:
>>> 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
>>> original.
>
>> 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:
> http://www.lua.inf.puc-rio.br/~sergio/jit/
>
> The file lpeg.c has a function "generateprogram"
> that translates the instruction of the LPEG VM to
> x86 instructions.
>
> The file test.lua is the test file that comes with
> LPEG 0.9.
>
> 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").
>
> Sérgio
Hi Sérgio,
Thanks very much for sharing this! I tried compiling and running it
here (Windows-32) and it seems to work well. (I haven't tried
uncommenting all the TOFIXes yet, though.)
-Duncan