[Webkit-unassigned] [Bug 86813] WebKit spends ~20% of time in HTMLTextAreaElement::defaultValue() when opening a review page

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 17 23:20:31 PDT 2012


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





--- Comment #1 from Ryosuke Niwa <rniwa at webkit.org>  2012-05-17 23:19:35 PST ---
Obviously, we should be using StringBuilder in this function. But even then we still have O(n^2) algorithm here because parserAddChild is going to call this function whenever new child is added :(

373    String HTMLTextAreaElement::defaultValue() const
374    {
375        String value = "";
376    
377        // Since there may be comments, ignore nodes other than text nodes.
378        for (Node* n = firstChild(); n; n = n->nextSibling()) {
379            if (n->isTextNode())
380                value += toText(n)->data();
381        }
382    
383        return value;
384    }

Perhaps we can lazily update the default value when the parser is adding children?

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