LuaD: creating a flexible data filter system

Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Oct 16 16:42:09 PDT 2015


On Friday, 16 October 2015 at 09:01:57 UTC, yawniek wrote:
> hi,
>
> i'm reading in a stream of data that is deserialized into 
> individual frames.
> a frame is either of:
> a)  a specific D datastructure ( struct with a few 
> ulong,string,string[string] etc members), known at compile time
> b) json (preferably stdx.data.json)
>
> i now want to implement something where i can dynamically
> add lua filters that then get data out of these frames, create 
> a new lua object
> send it back to D code where its either sent to another lua 
> filter or at last
>  being serialized again to json und then being processed 
> further.
>
> ideally i would not like to copy all the data into a lua object 
> but directly access it
> from lua.
> is there an elegant approach to do this and support both a and 
> b cases?
>
> so far i did some benchmarks, mainly with string comparisons 
> and it turned out
> that luaD is about 10x faster than mruby and python D bridges.

I haven't done more than play with it so far, but see LuaJIT FFI. 
  Obv LuaJIT is fast too.  From memory I think you can access C 
structs directly.  In addition you can write meta methods that 
provide nice sugar for accessing, constructors, etc.



More information about the Digitalmars-d-learn mailing list