CanvasRenderingContext2D.clearRect() very slow with clipping




Canvas: 2D
3 years ago
2 years ago


(Reporter: Daniel Rentz, Unassigned)


({perf, testcase})

35 Branch
Windows 7
perf, testcase

Firefox Tracking Flags

(Not tracked)


(Whiteboard: [gfx-noted])



3 years ago
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0
Build ID: 20150122214805

Steps to reproduce:

Use canvas clearRect() method with a single rectangular clipping area.

Actual results:

Clearing rectangles with clipping area is much slower than without clipping.

Test case:

Output Firefox:
fillRect, no clip: 23ms
fillRect, clipped: 21ms
clearRect, no clip: 29ms
clearRect, clipped: 1545ms

Output Chrome:
fillRect, no clip: 25ms
fillRect, clipped: 17ms
clearRect, no clip: 23ms
clearRect, clipped: 22ms

Expected results:

Clearing rectangles should work as fast as without clipping.

Comment 1

3 years ago
Thanks for the report and for the testcase!

I can't reproduce on Mac, and this looks like it might be OS/graphic-driver specific.

Could you copy the data from the Graphics section of about:support <> here and also look up the graphics driver version?

Also it might be worth re-testing with the most recent pre-release version <>, first creating a new Firefox profile <>.
Component: Untriaged → Canvas: 2D
Keywords: perf, testcase
Product: Firefox → Core

Comment 2

3 years ago
Using latest release (FF 36.0.4), latest graphics driver. Can still reproduce. Maybe Windows only?

Graphics info:

Direct2D aktiviert	true
DirectWrite aktiviert	true (6.2.9200.16571)
Geräte-ID	0x0fd4
GPU #2 aktiv	false
GPU-beschleunigte Fenster	1/1 Direct3D 11 (OMTC)
Karten-Beschreibung	NVIDIA GeForce GTX 660M
Karten-RAM	2048
Karten-Treiber	nvd3dumx,nvwgf2umx,nvwgf2umx nvd3dum,nvwgf2um,nvwgf2um
Subsys-ID	21151043
Treiber-Datum	3-13-2015
Vendor-ID	0x10de
WebGL-Renderer	Google Inc. -- ANGLE (NVIDIA GeForce GTX 660M Direct3D9Ex vs_3_0 ps_3_0)
windowLayerManagerRemote	true
AzureCanvasBackend	direct2d
AzureContentBackend	direct2d
AzureFallbackCanvasBackend	cairo
AzureSkiaAccelerated	0

Comment 3

3 years ago
Results with Nightly 40.0a1:

fillRect, no clip: 13ms
fillRect, clipped: 13ms
clearRect, no clip: 17ms
clearRect, clipped: 695ms
Is this still an issue?
Flags: needinfo?(daniel.rentz)

Comment 5

2 years ago
Well, just try it out. Link to test case has been given in the initial report.

Results with FF 41.0.1:
fillRect, no clip: 14ms
fillRect, clipped: 13ms
clearRect, no clip: 23ms
clearRect, clipped: 511ms

So, yes, still an issue.
Flags: needinfo?(daniel.rentz)
Whiteboard: [gfx-noted]
It looks like things improved for you between Firefox 35 and 41. I've tested this locally on my Macbook Pro and I confirm the issue but I think I've also found a regression.

Results after 10 testruns:
> Chrome 45 scores 42ms over 10 testruns
> Firefox 24 scores 127ms over 10 testruns [202% worse than Chrome]
> Firefox 40 scores 537ms over 10 testruns [1179% worse than Chrome, 323% worse than Firefox 24]
> Firefox 44 scores 561ms over 10 testruns [1236% worse than Chrome, 342% worse than Firefox 44]

At the very least I'm marking the bug as confirmed. However we probably need to investigate the major perf regression before we can begin to look at competitiveness.
Ever confirmed: true
(In reply to Anthony Hughes, QA Mentor (:ashughes) from comment #6)
> > Firefox 44 scores 561ms over 10 testruns [1236% worse than Chrome, 342% worse than Firefox 44]
(Typo: this should read '342% worse than Firefox 24')
You need to log in before you can comment on or make changes to this bug.