Bug 57059

Summary: input field with focus makes appendChild operation ~42x slower
Product: WebKit Reporter: Igor Minar <iiminar>
Component: DOMAssignee: Emil A Eklund <eae>
Status: VERIFIED FIXED    
Severity: Major CC: abarth, commit-queue, dglazkov, eae, eric, webkit.review.bot
Priority: P2 Keywords: HasReduction
Version: 528+ (Nightly build)   
Hardware: Mac (Intel)   
OS: OS X 10.5   
Attachments:
Description Flags
reduced test case
none
Patch none

Igor Minar
Reported 2011-03-24 15:36:07 PDT
Attached is a reduced test case from a large application that suffers from latency issues in Chrome/WebKit due to slow dom manipulation (specifically adding child nodes via appendChild). The issue perf issue occurs only if the input field has a focus, if the same set of dom operations are invoked via provided button, the dom manipulation is fast. I measured the perf difference and constantly see ~42x slowdown if the input field has focus (tested with r81868). Test instructions: - open the test case - note how long it took to add 1000 li elements to the list present on the page (the number is displayed) - click on the "toggle input" button, to cause 1000 li nodes to be removed from the list - click on the "toggle input" button again to cause 1000 li nodes to be appended to the list and note how long it took - now do the same by typing "x" into the input field and removing it and compare the results You can also try invoking update('x') and update('') from console with and without placing focus on the input field with focus() to see the same results. When the same test is run in Firefox 4, placing focus on the input field makes no difference in performance of appendChild operation. I also tried testing the issue with Safari 5.0.4, and while it's not as bad there, the slowdown is ~21x.
Attachments
reduced test case (1.81 KB, text/html)
2011-03-24 15:38 PDT, Igor Minar
no flags
Patch (5.17 KB, patch)
2011-04-15 11:36 PDT, Emil A Eklund
no flags
Igor Minar
Comment 1 2011-03-24 15:38:02 PDT
Created attachment 86848 [details] reduced test case
Igor Minar
Comment 2 2011-03-24 15:43:55 PDT
I also filed https://bugs.webkit.org/show_bug.cgi?id=57061 which in combination with this issue kills our app in WebKit/Chrome.
Emil A Eklund
Comment 3 2011-04-15 11:36:01 PDT
Dimitri Glazkov (Google)
Comment 4 2011-04-15 11:42:07 PDT
Comment on attachment 89819 [details] Patch great! Can you file a bug to put this whole deleteButtonController business behind a compile flag? Most builds of WebKit don't need it.
WebKit Commit Bot
Comment 5 2011-04-15 17:03:21 PDT
Comment on attachment 89819 [details] Patch Clearing flags on attachment: 89819 Committed r84056: <http://trac.webkit.org/changeset/84056>
WebKit Commit Bot
Comment 6 2011-04-15 17:03:26 PDT
All reviewed patches have been landed. Closing bug.
WebKit Review Bot
Comment 7 2011-04-15 18:22:24 PDT
http://trac.webkit.org/changeset/84056 might have broken WinCairo Debug (Build)
Igor Minar
Comment 8 2011-04-19 23:48:03 PDT
I was able to manually verify the fix with the r84295 nightly build. Thanks for the fix, Emil.
Emil A Eklund
Comment 9 2011-04-20 07:48:53 PDT
Cool, thanks for verifying!
Note You need to log in before you can comment on or make changes to this bug.