lua-users home
lua-l archive

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


On 22 Mar 2018, at 20.29, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:

>> Any feedback, critique, questions, comments etc. are welcome!
> 
> I am particularly puzzled by this result:
> 
>> Benchmark        Unmodified    Patched   Patched
>>                 Tables        Tables    Arrays
>> Scatter-read     0.200s        0.208s    0.170s
> 
> If I undestood correctly the code, the Patched Arrays implementation
> uses exactly the same code as Unmodified Tables for reads. Can you
> explain this difference?

Without diving deeper into it, I would guess that in this case some elements of the table go into the hash part (the data is sparse because of random access pattern in the benchmark). Look ups from the hash map is slower than reading from an array which is always stored linearly.

Petri