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
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.