Open Bug 582489 Opened 14 years ago Updated 2 years ago

Much slower on particle demo due to canvas performance issues with fillRect

Categories

(Core :: Graphics: Canvas2D, defect)

x86
macOS
defect

Tracking

()

Tracking Status
blocking2.0 --- -
status2.0 --- ?

People

(Reporter: bzbarsky, Unassigned)

References

(Depends on 1 open bug)

Details

Attachments

(1 file)

BUILD: Current trunk mac build

STEPS TO REPRODUCE:
1)  Load the attachment.
2)  Click the "Start" button.
3)  Wait a bit for the FPS to stabilize

ACTUAL RESULTS: 8fps or so on my machine

EXPECTED RESULTS: 20+ fps like Safari and Chrome (note that Opera doesn't support fillText so doesn't run the testcase).

ADDITIONAL INFORMATION:  Shark says that 85% of our time is spent under nsCanvasRenderingContext2D::FillRect.  This breaks down as (all percentages are of total time, and are times under, not in):

2% ~gfxPath
2% free under nsCanvasRenderingContext2D::DrawRect
2% gfxContext::CopyPath
5% gfxContext::Rectangle 
1% gfxContext::UserToDevice (under nsCanvasRenderingContext2D::DrawPath)
3% gfxContext::GetUserPathExtent
68% _cairo_quartz_surface_fill

The fill stuff is:

CGContextFillPath: 25%
_cairo_quartz_setup_state: 24% (calling CGContextSetRGBStroke/FillColor and
                                CGContextSaveGState)
_cairo_quartz_teardown_state: 7% (all CGContextRestoreGState)
_cairo_quartz_cairo_path_to_quartz_context: 7% (all under
                                                _cairo_path_fixed_interpret).

I'm having a real hard time believing that rectangle fills need all that gunk (complete with the _cairo_path_fixed_interpret!)....  Is this really expected?
Attached file The testcase
sounds like we need to an optimization to recognize when the path we're drawing is just a rectangle...
Note that I've seen this pop up before; fillRect is often somewhat of an issue in canvas profiles.  This one was just more egregious than most.  ;)  Point being, it's not that this particular testcase is somehow doing something weird... at least as far as I can tell.

I also don't know whether there are similar issues on non-Mac platforms.
I don't like not blocking on this, but I also can't justify it if it's not a regression. :( Would gladly take a patch!
blocking2.0: ? → -
OK.  Is there a way to track this as a must-fix for post-2.0?  :(
status2.0: --- → ?
Depends on: 601176
This appears fine on windows, do we have a plan to attack this Jeff? Or would you say we're going at this through Azure?
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: