lua-users home
lua-l archive

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


On Sat, May 9, 2015 at 2:17 PM, Rena <hyperhacker@gmail.com> wrote:
But Lua also has some overhead with calling into C, doesn't it? So
some common operations are faster in pure Lua than in C? I'm sure I've
heard that.

If it's a relatively small piece of code, the cost of calling into C could be higher than the cost of just running it in Lua. On the other hand, luajit produces native machine code, which could easily call a C function with relatively little overhead; I'm not sure what that actually ends up looking like, with bookkeeping and state fixups and stuff. Plus, as pointed out earlier, calling C functions probably foils optimizer traces, so I'm not sure it'll even do it.

Does anybody know? Is Mike around?

--
Brigham Toskin