lua-users home
lua-l archive

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


On 7 March 2015 at 21:06, Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:

> 1) Luajit uses an optimized representation of values. In Lua 5.3 and
> in Ravi, the value is 16 bytes - and many operations require two loads
> / two stores. Luajit therefore will always have an advantage here.

I have been thinking about how to optimize the value representation in
Ravi. It seems that there is a way to at least optimize for doubles -
so that any operation involving a double only needs to store/load 8
bytes.

This can be done as follows I think:

Let the first 8 bytes hold a double.
Let the second 8 bytes hold all other value types.
The type tag can be held by using the payload section of a NaN in the
first 8 bytes.

In this scheme any operation involving a double will be more efficient
as it will only involve a single load/store of the double value.

Any views?

Regards
Dibyendu