[Webkit-unassigned] [Bug 119921] New: Parsing HTML entities shouldn't call malloc

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Aug 16 20:00:11 PDT 2013


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

           Summary: Parsing HTML entities shouldn't call malloc
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Keywords: BlinkMergeCandidate
          Severity: Normal
          Priority: P2
         Component: HTML DOM
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: rniwa at webkit.org
                CC: darin at apple.com, ggaren at apple.com, koivisto at iki.fi,
                    benjamin at webkit.org, akling at apple.com


https://chromium.googlesource.com/chromium/blink/+/f7f0532523c8ba48374d500a81f4a2127253a6e9

I've seen the HTML entity parser show up on a number of the backtraces for
malloc in profiles of top-1000000 sites. There's no reason to call malloc when
parsing HTML entities. This CL removes all the calls to malloc in the common
code paths.

This CL also untwists the code now that we don't need to support NEW_XML.
Rather than having a templated function do the work, we now do the work in a
normal function. Also, we no longer need to support XML's user-defined
entities, so we can go back to assuming that decoded entities are at most four
UTF-16 code units long, which removes the need for a variable length output
buffer. For good measure, I also replaced the buffer we use to recover from
parse errors with a Vector that has inline capacity so that we don't need to
call malloc for it in the common case.

This CL reduces the number of calls to malloc on http://thithtoolwin.com by
17%. This site isn't particularly pathological. It was just the straw that
broke the camel's back and caused me to write this CL.

-- 
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