lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Sep 13, 2010 at 2:35 PM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> This reminds me of something I was wondering about: could a special
>> version of LPeg be created that takes direct advantage of LuaJIT
>> acceleration, so that the "bytecode" of the PEG patterns itself gets
>> JITtered? Does LuaJIT support (even conceptually, if not at this
>> precise point in the beta) external C modules that have
>> JIT-specialised functions, like the functions in the standard Lua
>> modules are? If so, would it be possible for a single dynamically
>> linked library to contain both the standard and JIT versions, or would
>> they need to be separate? Or is this all a blind alley, and the only
>> realistic way would be a port of LPeg to Lua itself?
>
> 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.
>
> -- Roberto
>
>

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.

-Duncan