Bug 18466 - webkit's performance inferior to Firefox/Opera on Opera dhtml benchmark
Summary: webkit's performance inferior to Firefox/Opera on Opera dhtml benchmark
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Dave Hyatt
URL: http://my.opera.com/desktopteam/blog/...
Depends on:
Reported: 2008-04-13 14:00 PDT by Michael Zedler
Modified: 2008-04-13 23:26 PDT (History)
2 users (show)

See Also:

Experimental patch that tries unioning to avoid complex regions. (3.35 KB, patch)
2008-04-13 18:18 PDT, Dave Hyatt
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Zedler 2008-04-13 14:00:59 PDT
Above URL contains two painting performance tests, with Webkit performing worse compared to Firefox/Opera.
Problem mentioned to Catfish_Man on irc. His profiling resulted in
"woah, ~25% in CGSUnionRegionWithRect", 
"paying a heavy cost in [NSView setNeedsDisplayInRect:] both from CGSUnionRegionWithRect and ObjC overhead"

He considers this worth a bug report, so here it is.
Comment 1 David Smith 2008-04-13 14:04:21 PDT
Created attachment 20504
Comment 2 David Smith 2008-04-13 14:09:54 PDT
http://dscoder.com/bench2.mshark is the second one; it's 19kB too large to attach to bugzilla :(

Anyway, my guess is that it's hitting some bad case of dirty rect coalescing.
Comment 3 Dave Hyatt 2008-04-13 14:33:21 PDT
These both performed really well for me, but I did not compare them to FFX and Opera.
Comment 4 Dave Hyatt 2008-04-13 14:36:24 PDT
Yeah FFX does better.  This is probably all about how you coalesce dirty rects.  The problem is what may work well on one test will work poorly on another.  Many small moving objects will have a bias towards union, whereas a small number of faraway objects will have a bias toward separation.
Comment 5 Dave Hyatt 2008-04-13 14:38:48 PDT
We should be unioning though so I'm surprised by our inferior performance.
Comment 6 Dave Hyatt 2008-04-13 14:57:56 PDT
We're unioning so I don't think this is coalescing.  I'm not sure what is going on.
Comment 7 Dave Hyatt 2008-04-13 15:29:12 PDT
Appears to be an issues with regions on OS X.  The more rects you add to a region (setNeedsDisplayInRect), the slower that method gets.  It's O(n^2).  We may need to do unioning ourselves when many little objects are moving together on-screen and then just send the unioned rect to setNeedsDisplayInRect.

Comment 8 Michael Zedler 2008-04-13 16:21:05 PDT
I found this post on the opera blog:

AMD Opteron 185 / Socket 939 / 7900GT / 2GB (No VM)


Opera 9.50 Beta Build 9841

Opera 9.50 Beta Build 9864
Comment 9 Michael Zedler 2008-04-13 16:30:33 PDT
and another performance comparison at http://www.metalraise.com/misc/DHTMLDrawingPerformance.png
Comment 10 Michael Zedler 2008-04-13 16:37:29 PDT
... and wading through the blog further: http://www.metalraise.com/misc/DHTMLDrawingPerformanceSys2.png
Comment 11 Dave Hyatt 2008-04-13 18:18:32 PDT
Created attachment 20509 [details]
Experimental patch that tries unioning to avoid complex regions.
Comment 12 Dave Hyatt 2008-04-13 23:26:00 PDT
Fixed in r31858.