lua-users home
lua-l archive

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

On Thu, Mar 27, 2014 at 12:38 PM,  <> wrote:
> On Thu, Mar 27, 2014 at 12:10:35PM -0700, Coroutines wrote:
>> I kind of wish another member were added for referencing a string
>> after this one.  <cut>
> Segmented strings/ropes are deceptive. Neat for compression
> (keep duplicate segments of trie once) and prefix matching.
> For general use, though, it's a very bad idea cpu-cache wise:
> x86 cpus just love to memcpy as that operation never leaves
> memory controller. Now randomly jumping around memory for
> LL traversal introduces data dependency, round-trip latency,
> additional unpredictable branches....
> Not to mention increased complexity of traversing code which
> is difficult to abstract away in C.

One could then argue that this would only be useful for strings that
would not fit in cache anyway -- still seems slow to realloc for
single-char concatenations (and then the new hash being computed).