lua-users home
lua-l archive

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


On 26 May 2015 at 23:18, Brigham Toskin <brighamtoskin@gmail.com> wrote:
> Do you plan to be able to specify the return type(s) of functions? It
> wouldn't always be possible with the dynamic nature of Lua functions, but if
> a function always returned the same number/types of data, it could eliminate
> some runtime checks.

Hi,

In this and other benchmarks such as fannkuch-redux I think the
bottleneck is the floating point arithmetic. In LuaJIT due to the way
the value is stored, floating point operations are efficient. In Ravi
each floating point operation requires an additional store operation
as the type of the value has to be set. I do not have firm evidence
that this is causing the degradation, it is only a suspicion. My hope
was that LLVM will optimise the extra store away especially when the
value is being updated repeatedly in a loop - and the compiler can
tell that there is nothing else changing the type so updating the type
is superfluous. But maybe I am missing some aliasing metadata which is
preventing this optimisation.

I have a new version of the benchmark that does not use any function
calls in the looping part - however it only slightly improves
performance. That is why I don't believe that the calls are the issue
here.

I think I need to implement a NaN tagging solution for value types -
which will certainly help operations involving floating point numbers.

Regards
Dibyendu