Re: Yielding across C boundaries

  • From: Daurnimator <quae@xxxxxxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 3 Jan 2013 09:36:47 +1100

On 3 January 2013 02:55, Mike Pall <mike-1301@xxxxxxxxxx> wrote:
> Coco was used for LuaJIT 1.x. But switching C stacks caused too
> many problems. That's why LuaJIT 2.0 doesn't use it anymore (it's
> able to yield across builtins, but not across arbitrary C calls).
>

Can we expect to eventually see lua_yieldk, lua_callk, and lua_pcallk
added to luajit?

>
> You're probably using LuaJIT for its performance benefits. But
> callbacks from C into the VM are slow -- really slow compared to
> everything else. If possible, rewrite the intervening C code in
> Lua (maybe with the help of the FFI) and/or switch to a pull-style
> API (iterator instead of callbacks).
>

Btw, why is this? It came up in an irc channel a couple of days ago:
I said that iteration would be favourable; but was unable to cite why...

Other related posts: