lua-users home
lua-l archive

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


On 3/5/2015 4:05 AM, Dibyendu Majumdar wrote:
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.

Just make the destination volatile. Also remember to use SSE2.

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia