Summary: | Web Inspector: speed-up Element.prototype.removeChildren | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Nikita Vasilyev <me> | ||||||
Component: | Web Inspector (Deprecated) | Assignee: | Nikita Vasilyev <me> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | bweinstein, eric, joepeck, keishi, pfeldman, pmuellr, rik, timothy, yurys | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | All | ||||||||
OS: | All | ||||||||
Attachments: |
|
Description
Nikita Vasilyev
2010-08-08 04:53:04 PDT
Created attachment 63840 [details]
patch
Comment on attachment 63840 [details] patch In fact I've done the opposite optimization earlier: https://bugs.webkit.org/show_bug.cgi?id=31160 Timeline was lagging visually on scrolling and clearing + shark was showing this to be the slow operation. I'd suggest that you try those. Wrt benchmarks, I think they lack listeners - adding those would change the WebKit picture a lot. I know that the bindings have improved, but still, single call to native will always be ways faster. (In reply to comment #2) > (From update of attachment 63840 [details]) > In fact I've done the opposite optimization earlier: > https://bugs.webkit.org/show_bug.cgi?id=31160 > > Timeline was lagging visually on scrolling and clearing + shark was showing this to be the slow operation. I'd suggest that you try those. Wrt benchmarks, I think they lack listeners - adding those would change the WebKit picture a lot. I know that the bindings have improved, but still, single call to native will always be ways faster. Oh, I didn't think about reflow. At this case `element.textContent = ""` would be faster. By the way, what are Wrt benchmarks? Created attachment 63842 [details] this.textContent = "" http://elv1s.ru/files/js/removeChildren.html Now innerHTML and textContent works the same. removeFirstChild is a little slower. When inspecting the DOM, there are many calls of removeChildren while an element already doesn't have children. So I added `if (this.firstChild)` check. Comment on attachment 63842 [details]
this.textContent = ""
Thanks for doing this!
Comment on attachment 63842 [details] this.textContent = "" Clearing flags on attachment: 63842 Committed r64952: <http://trac.webkit.org/changeset/64952> All reviewed patches have been landed. Closing bug. |