lua-users home
lua-l archive

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


2012/3/22 Roberto Ierusalimschy <roberto@inf.puc-rio.br>:
>> Indeed. I'm pretty sure that I use very long strings as index all
>> over the place. But does this patch indeed prevent long strings to
>> be unique indices? For me the interning of strings is one of the
>> charms of Lua.
>
> This patch does not change anything in the semantics of Lua. The
> interning of strings always has been and continues to be invisible to
> the programmer. It only afects performance, in both directions.
> (There is a cost for interning a string.)
>
> So, the question is: thus the savings in not interning some strings
> compensates the losses in performance in indexing some strings? The only
> way that I see to answer that is profiling real programs.
>
> -- Roberto
>

So, can makes long string just using a few of bytes to calculate hash
value? using a random seed to choose how to skip bytes? this will be
better.