[Webkit-unassigned] [Bug 107370] New: consumeNamedEntity could be smarter about memory management

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Jan 19 03:09:49 PST 2013


https://bugs.webkit.org/show_bug.cgi?id=107370

           Summary: consumeNamedEntity could be smarter about memory
                    management
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: New Bugs
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: eric at webkit.org
                CC: abarth at webkit.org, tonyg at chromium.org


consumeNamedEntity could be smarter about memory management

Profiling the HTML parser, I see 0.1% of time parsing the HTML5 spec, spent in fastMalloc, allocating StringBuilder buffers for potential entities:

Running Time    Self        Symbol Name
220.7ms    6.0%    220.7         WTF::fastMalloc(unsigned long)
3.7ms    0.1%    0.0           WTF::StringBuilder::allocateBuffer(unsigned char const*, unsigned int)
3.7ms    0.1%    0.0            WTF::StringBuilder::append(unsigned char const*, unsigned int)
3.7ms    0.1%    0.0             WTF::StringBuilder::append(unsigned short const*, unsigned int)
1.6ms    0.0%    0.0              WebCore::HTMLEntityParser::consumeNamedEntity(WebCore::SegmentedString&, WTF::StringBuilder&, bool&, unsigned short, unsigned short&)

This seems silly to spend any time here.  We know the maximum length of a valid entity (and it's quite short), we could just use a Vector instead of a StringBuilder.

   inline static bool consumeNamedEntity(SegmentedString& source, StringBuilder& decodedEntity, bool& notEnoughCharacters, UChar additionalAllowedCharacter, UChar& cc)
    {
        StringBuilder consumedCharacters;
        HTMLEntitySearch entitySearch;
        while (!source.isEmpty()) {

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list