[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Mutable strings
- From: David Kastrup <dak@...>
- Date: Mon, 16 Jul 2007 09:40:29 +0200
Rici Lake <email@example.com> writes:
> On 13-Jul-07, at 2:03 PM, Tony Finch wrote:
>> On Fri, 13 Jul 2007, Rici Lake wrote:
>>> All of this is based on my theory that the cost of interning
>>> long strings is not the interning per se, since the Lua hashing
>>> function only examines a maximum of 32 characters.
>> It'll still pull the whole string into the cache if it's 2KB long or
>> because a cache line is (usually) 64 bytes.
> It would be very surprising if a newly created string wasn't
> already in the cache, no?
Not at all, since Lua is an extension language with its own data
structures. Entering Lua entails _converting_ data into Lua's
representation. The actual contents of those data will have been
written potentially much earlier.