lua-users home
lua-l archive

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


On Fri, Jan 6, 2012 at 7:01 PM, steve donovan <steve.j.donovan@gmail.com> wrote:
> Wow, another example of 'things which are larger than Lua', to
> continue a recently popular meme.
>
> (Another good example of that would be PCRE)
>
> Better to stick to C here, since you have to be close to the machine
> here anyway!
>
> steve d.  (who still has a sore head from trying to write a C++
> interpreter that could process the STL)
>

You must forgive me for not quite following that meme.. :p

About close to the machine, it turns out that it's not very
distinctive between Boost.Context and libcoroutine... Currently
Boost.Context is all running on its fcontext implementation, the fiber
implementation on windows isn't even included for now, and
libcoroutine is running fiber on windows.

My crude benchmark is just like this: https://gist.github.com/1571187
I made the codes based on different C/C++ coroutine library do
something like lua code in that gist do. Boost bloats binary, but
speed-wise they are pretty much on par with one another. BTW, although
LuaJIT's coroutine.yield and resume are still NYI FastFunc, I get
about the same performance when the above lua code is run by LuaJIT.
Which means both C coroutine libraries must be really slow?

I'll try to benchmark these 2 scenario next:
1. A tight loop in C keeps calling back to Lua through LuaJIT FFI callback.
2. LuaJIT FFI calls to C in a tight loop, and yield there (C
coroutine), and the main coroutine (in C) will keep resuming to that
yield point.

Johnson