lua-users home
lua-l archive

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


On 25 November 2016 at 19:26, Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
> I was reminded about this as I have been thinking about ways to make
> the calls to math functions cheap - by bypassing the normal Lua
> calling conventions. One approach I thought of is to have specialized
> function type code for C functions that take a double parameter and
> return a double.  This could be used by the VM to directly call the C
> function.
>
> This would significantly improve the performance of JITed code in Ravi
> that needs to call maths functions in a loop. Right now the overhead
> is such that performance is degraded in such scenarios.
>
> I understand that LuaJIT automatically optimises calls to math
> functions; not sure how it detects such calls though.
>

I found this post which seems to suggest a similar approach:

http://lua-users.org/lists/lua-l/2006-09/msg01011.html