Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Edit, yes, v5.2 supports the NaN trick (see the comments above http://www.lua.org/source/5.2/lobject.h.html#NNMARK), but only on x86.

I suppose the Lua authors wanted to avoid the memory limitations of LuaJIT on 64bits machines.

---- Original below:

I thought v5.2 used NaN tagging but I may be wrong. At least the beta versions did. I misremembered that post to refer to the final version: http://lua-users.org/lists/lua-l/2011-07/msg00180.html

Quoted in full:

----

Lua 5.2 beta implements the "NaN trick": it packs all Lua values into a single double value by representing non-numeric values as signaled NaNs, which are (usually) not produced by the system.

This trick should work on most 32-bit machines that follow IEEE 754-2008 for double representation. However, currently it is being enabled only by predefined macro __i386__ (and similars). We would like to know what other platforms could benefit from this trick (and what macros should we check in luaconf.h). You can force the trick by compiling Lua with -DLUA_NANTRICKLE (for little endian systems) or -DLUA_NANTRICKBE (for big endian).

(Of course, we would also like to know whether there are problems with this implementation.)

-- Roberto

----

I also think I remember people (maybe Mike Pall) reporting perf regressions between 5.2 and 5.3 because of the cache bloat introduced by mandatory 128bits values (on 64bits systems).



Thanks, my bad. I didn't know they tried it in 5.2.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: