lua-users home
lua-l archive

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


On Sat, Mar 19, 2011 at 6:48 PM, Matthew Wild <mwild1@gmail.com> wrote:
>> P.S. Honestly, when I hear that something works below Lua API, I reach
>> for a gun. Henning, not to start a holywar, but I'm very interested in
>> the... design motivation for this.
>
> The first question that entered my mind was "10 times faster than
> what?". I think the motivation is fairly obvious :)

The results posted show Fleece tested against lua-json4 and luajson.

I think that this is a relatively safe place to apply such black
magic. The table is a core feature of Lua and its implementation
details are unlikely to change without announcement. A Lua to JSON
converter is a powerful enhancement for a web application server that
uses Lua tables for its DDL, while needing also to communicate
efficiently with JavaScript clients. Most importantly, the application
does not modify any internal data, but creates a duplicate in a
different format. This type of operation is unlikely to cause errors
in the data it is copying. When an error does occur, it is unlikely to
cause undesired operation other than unreliable output, which is
readily detectable.

Interesting, from the github - https://github.com/Eonblast/fleece-lite - page:

    Compatibility

    Fleece works with Lua 5.1.4 and 5.1.4-2, it can be adapted to other
    Lua versions or LuaJIT and will be ported to 5.2.

So... It's a single function optimization that may be highly relevant
to Ajax applications using Lua as server-side scripting language
(particularly Lua as a DDL) that is at least as portable as FFI and is
already available for current stable Lua.

I know that Python gets a lot of attention in discussions about
whether Lua is competitive in a web development environment, but the
real long term competitor with Lua in this space comes from the
embedded systems space as well - ECMAScript. Laying aside the
supporting argument for that assertion in order to avoid high-jacking
the thread, I think that having a fast Lua to JSON translator takes
much away from one of the key attractions of ES5 in a web environment
- "Plays nice with Ajax."

For anyone unfamiliar with Greek mythology and curious about the name,
I suspect that the titular Fleece is the one quested after by "JSON"
and the Argonauts. Incidentally, Ajax (one of the heroes in the Trojan
war) was a son of an Argonaut.

Chris
--
Yippee-ki-yay, coffee maker.