Changeset 112543 in webkit


Ignore:
Timestamp:
Mar 29, 2012 10:03:59 AM (12 years ago)
Author:
kling@webkit.org
Message:

String: Subscript operator shouldn't force conversion to 16-bit characters.
<http://webkit.org/b/82613>

Reviewed by Anders Carlsson.

Forward String::operator[] to StringImpl::operator[] instead of indexing into characters().
This avoid implicit conversion of 8-bit strings to 16-bit, and as an example, reduces memory
usage on http://www.allthingsd.com/ by 360kB.

  • wtf/text/WTFString.h:

(WTF::String::operator[]):

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r112401 r112543  
     12012-03-29  Andreas Kling  <kling@webkit.org>
     2
     3        String: Subscript operator shouldn't force conversion to 16-bit characters.
     4        <http://webkit.org/b/82613>
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Forward String::operator[] to StringImpl::operator[] instead of indexing into characters().
     9        This avoid implicit conversion of 8-bit strings to 16-bit, and as an example, reduces memory
     10        usage on http://www.allthingsd.com/ by 360kB.
     11
     12        * wtf/text/WTFString.h:
     13        (WTF::String::operator[]):
     14
    1152012-03-28  Carlos Garcia Campos  <cgarcia@igalia.com>
    216
  • trunk/Source/WTF/wtf/text/WTFString.h

    r111778 r112543  
    187187        if (!m_impl || index >= m_impl->length())
    188188            return 0;
    189         return m_impl->characters()[index];
     189        return (*m_impl)[index];
    190190    }
    191191
Note: See TracChangeset for help on using the changeset viewer.