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.
Created attachment 20504
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.
These both performed really well for me, but I did not compare them to FFX and Opera.
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.
We should be unioning though so I'm surprised by our inferior performance.
We're unioning so I don't think this is coalescing. I'm not sure what is going on.
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.
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
and another performance comparison at http://www.metalraise.com/misc/DHTMLDrawingPerformance.png
... and wading through the blog further: http://www.metalraise.com/misc/DHTMLDrawingPerformanceSys2.png
Created attachment 20509 [details]
Experimental patch that tries unioning to avoid complex regions.
Fixed in r31858.