Changes between Version 6 and Version 7 of EfficientStrings


Ignore:
Timestamp:
Aug 29, 2012 2:20:49 PM (12 years ago)
Author:
benjamin@webkit.org
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • EfficientStrings

    v6 v7  
    6666
    6767Note: If you need to append a literal char, {{{ builder.append('c'); }}} is more efficient than {{{ builder.appendLiteral("c"); }}}
     68
     69
     70=== Memory ===
     71
     72Any of the string class uses memory on the heap to allocate a StringImpl. The only way to avoid allocating new memory is to use the methods taking a constant literal.
     73
     74On 64bits, the memory used for StringImpl vary between 28 bytes to (28 + length + length * 2) bytes for a string from copy that has been converted to 16 bits.
     75
     76For example, a 10 characters string from copy converted to 16bits + the allocators alignment would typically take:[[BR]]
     77-28 + 10 = 38 -> typically allocated to 64bytes[[BR]]
     78-10 * 2 = 20 -> typically allocated to 32bytes[[BR]]
     79-->96bytes.[[BR]]
     80Be careful when allocating strings.