Changeset 150912 in webkit


Ignore:
Timestamp:
May 29, 2013 11:37:10 AM (11 years ago)
Author:
rniwa@webkit.org
Message:

Remove the size of DataVector in HTMLToken
https://bugs.webkit.org/show_bug.cgi?id=116931

Reviewed by Sam Weinig.

Merge https://chromium.googlesource.com/chromium/blink/+/7977721e62c471bfa17b84d82cd5d8243a4eb9a9.

Shink HTMLToken by 1.5 kB

HTMLToken has an inline vector for buffering characters during tokenization. We
originally picked the inline capacity of this buffer somewhat arbitrarily. This
CL tunes the number based on a somewhat non-scientific browse of a number of
popular web sites.

I (abarth) instrumented content_shell to log the length of each complete DataVector. I
then browsed around a variety of web sites to collect data. The 99% percentile
of DataVector lengths was just shy of 250 characters. I rounded that up to 256
because powers of two are pretty. That means we'll malloc an external buffer
less than 1% of the time, which seems fine.

  • html/parser/HTMLToken.h:

(HTMLToken):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r150910 r150912  
     12013-05-29  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Remove the size of DataVector in HTMLToken
     4        https://bugs.webkit.org/show_bug.cgi?id=116931
     5
     6        Reviewed by Sam Weinig.
     7
     8        Merge https://chromium.googlesource.com/chromium/blink/+/7977721e62c471bfa17b84d82cd5d8243a4eb9a9.
     9
     10        Shink HTMLToken by 1.5 kB
     11
     12        HTMLToken has an inline vector for buffering characters during tokenization. We
     13        originally picked the inline capacity of this buffer somewhat arbitrarily. This
     14        CL tunes the number based on a somewhat non-scientific browse of a number of
     15        popular web sites.
     16
     17        I (abarth) instrumented content_shell to log the length of each complete DataVector. I
     18        then browsed around a variety of web sites to collect data. The 99% percentile
     19        of DataVector lengths was just shy of 250 characters. I rounded that up to 256
     20        because powers of two are pretty. That means we'll malloc an external buffer
     21        less than 1% of the time, which seems fine.
     22
     23        * html/parser/HTMLToken.h:
     24        (HTMLToken):
     25
    1262013-05-29  Brent Fulgham  <bfulgham@apple.com>
    227
  • trunk/Source/WebCore/html/parser/HTMLToken.h

    r148921 r150912  
    9191    };
    9292
    93     typedef WTF::Vector<Attribute, 10> AttributeList;
    94     typedef WTF::Vector<UChar, 1024> DataVector;
     93    typedef Vector<Attribute, 10> AttributeList;
     94    typedef Vector<UChar, 256> DataVector;
    9595
    9696    HTMLToken() { clear(); }
Note: See TracChangeset for help on using the changeset viewer.