lua-users home
lua-l archive

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


On Mon, Jul 6, 2015 at 5:12 PM, Cosmin Apreutesei
<cosmin.apreutesei@gmail.com> wrote:
>> No, I did it by inspection
>
>
> Well you did made me paranoid for a bit so I just added more unit tests to
> make sure :)

My first tests were misleading because I saw higher memory usage after
destroying all tuples. :P But then I added some code to inspect the
internals and discovered it was a false positive, and the data
structures were actually getting cleaned up after all.

>
>> > I know there are two operations, I must be missing something else then
>> > because I can't see how that would be any different for tuples than for
>> > strings.
>>
>> I think at this point I'm the one missing something, because I have no
>> idea what you're confused about.
>
>
> Ok my point is that hashing tuples is no different than hashing strings[1]
> so the performance profile should be the same. You seem to disagree but
> without being specific it's hard to go on. Also, I don't think Lua authors
> are down with tuples (I may be wrong but I don't think they see much value
> in them either), so there's little point to continue.
>
> [1] http://www.lua.org/source/5.3/lstring.c.html#luaS_hash
>

Ah. See, I thought you were proposing an implementation that would
have resulted in all or a high proportion of table accesses using
tuples to require hashing at access time instead of at time of tuple
construction. If you're proposing interning or ahead-of-time or
memoized hashing, then the performance profile IS the same as strings.

/s/ Adam