lua-users home
lua-l archive

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


On 18 March 2018 at 15:46, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
>> Well, I took a stab at it myself for some Sunday fun. It’s still very much work in progress, but the initial results seem promising.
>>
>> Here are some benchmarking results for a large number of table reads/writes vs. array reads/writes.
>>
>> [...]
>
> Among other problems, your implementation slows down table access,
> because every access first has to check whether the value is an array.

Indeed this extra check is a price one has to pay for having an array
type (or sub-type). In Ravi I give preference to table type for
standard Lua bytecodes, but a check is needed (I do use compiler flags
to make the table outcome a high probability when possible). For
extended bytecodes where more type information is available this is
not an issue.

I think performance wise there will be the cost of an additional check
in standard Lua, the same way the Integer sub-type caused additional
check for numeric types.

Regards
Dibyendu