[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Pooling of strings is good
- From: Coroutines <coroutines@...>
- Date: Mon, 25 Aug 2014 15:19:23 -0700
On Mon, Aug 25, 2014 at 3:07 PM, Robert Virding <rvirding@gmail.com> wrote:
> Got into this discussion late.
>
> If you have pooling of strings how can you safely use them for dynamic data,
> for example from input, if you want the system to survive for any length of
> time? Or have I misunderstood what is meant by pooling?
Hmm, please elaborate :> We've been talking about pooled strings in
the sense that once a string is created -- it does not change. Not
only that, but it is checked for equality against the existing strings
Lua has already "seen"/interned. When a string is created a hash is
computed based on the contents of that string. So when you compare
'cat' == 'dog' Lua is internally doing a comparison of the hash of
"cat" to the hash of "dog" -- but it also may be as simple as a
pointer comparison. (I don't know for sure in every instance)
- References:
- Re: Pooling of strings is good, Jay Carlson
- Re: Pooling of strings is good, Coroutines
- Re: Pooling of strings is good, Sean Conner
- Re: Pooling of strings is good, Coroutines
- Re: Pooling of strings is good, Philipp Janda
- Re: Pooling of strings is good, Coroutines
- Re: Pooling of strings is good, Philipp Janda
- Re: Pooling of strings is good, Coroutines
- Re: Pooling of strings is good, Axel Kittenberger
- Re: Pooling of strings is good, Coroutines
- Re: Pooling of strings is good, Roberto Ierusalimschy
- Re: Pooling of strings is good, Coroutines
- Re: Pooling of strings is good, Robert Virding