lua-users home
lua-l archive

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


> I imagine that one problem is going to be programs that use
> memoization, in which case the keys are often pretty arbitrary
> (whereas "typical" use of string keys probably favors short strings)
> _and_ expected to be fast.  this seems to be a pretty popular
> technique in Lua...

Unlike short strings, long strings rarely are literals in the program.
People tend not to write t.thisIsAVeryLongStringButBarelyLongEnough.
Long strings usually are produced somehow, through computations or
input. So, the overhead of the indexing may be diluted (and
partially compensated) by all these other costs.

Of course, my answer (and your message) is just speculation. That iw
why we would like to see the behavior in real programs (not artificial
benchmarks).

Moreover, a small overhead may be acceptable as a price for solving
the "hash complexity attack" (that people will worry about despite all
contrary evidence).

-- Roberto