On 4 March 2015 at 03:15, KHMan wrote:
luajit is doing 3.2 billion iterations a second. Do you have a comparison
with a straight C sample? That would be informative, indicating the amount
of overhead we're looking at versus "C compiled with the minimum overhead".
[snip]
Re C sample - no I haven't done so. I did have a look at the Luajit
dump of machine code - it is really optimized to the bare minimum, so
a C version is unlikely to be much better than that. In any case for
very simple code like this test I suspect a C version when run through
an optimizer would recognize that actually the loop is not necessary
at all - and one could just return the final value! The code only
makes sense in Lua because of the semantics of the loop variable.