Open Bug 850114 Opened 11 years ago Updated 2 years ago

putImageData slowness

Categories

(Core :: Graphics: Canvas2D, defect)

x86
Linux
defect

Tracking

()

People

(Reporter: azakai, Unassigned)

Details

Attachments

(2 files)

Attached file testcase
Attached is a benchmark of putImageData, called once per frame (like many games and demos would). Firefox is 4x slower than Chrome in my tests (15fps vs 60fps, Linux).

This benchmark is based off of a testcase a user on emscripten-discuss presented while asking why his 2D canvas game was slow in Firefox.
I can`t reproduce slowness with test attached by Alon Zakai. I fix a little test. In my test FF.19 has 4FPS and Chrome.24 46FPS. 

Diff:
17,22d16
<   var data = this.image.data;
<   var len = data.length;
<   for (var i = 0; i < len; ++i) {
<     data[i] = i&255;
<   }
<  
23a18,22
>     var len = this.image.data.length;
>     for (var i = 0; i < len; ++i) {
>       this.image.data[i] = i&255;
>     }
>
Attachment #723933 - Attachment mime type: text/plain → text/html
Attachment #723933 - Attachment description: FF - 4FPS vs Chrome - 46FPS → testcase2 (4FPS vs 46FPS)
Which versions of Firefox and Chrome are you testing, and what graphics hardware do you have? On my machine (firefox nightly, chrome dev, intel GPU) I get 60fps in both browsers on your benchmark. If I increase the amount of writes to data[], I see chrome and firefox at about the same speed.

So slowness there, if you see it, might be a different issue than putImageData.

Note that testing on another machine, I get 60fps in my benchmark too. But adding a for loop of 10 iterations around the putImageData makes it show the issue once more, firefox is 1/2 the speed of chrome.
PC1: 
FF 19.0 (5 FPS)
Chrome 24.0.1297.0 dev (50 FPS)
Ubuntu 12.10
Intel(R) Core(TM)2 Quad CPU Q9400  @ 2.66GHz
4GB Ram
NVIDIA Corporation, GeForce 6600 GT/PCIe/SSE2, 2.1.2 NVIDIA 304.48
WM: i3

PC2:
Firefox 19.0.2 (6 FPS)
Chrome 25.0.1364.160 (30 FPS)
Ubuntu 12.10
Intel(R) Core(TM)2 Quad CPU    Q9400  @ 2.66GHz
4GB Ram
GeForce 8400 GS/PCIe/SSE2
WM: xmonad

PC3:
Firefox 18.0 (6 FPS)
Chrome 24.0.1312.69 (60 FPS)
Opera (21 FPS)
OpenSuse 12.2
Intel(R) Core(TM) i5-3550 CPU @ 3.30GHz
OpenGL vendor string: Tungsten Graphics, Inc
OpenGL renderer string: Mesa DRI Intel(R) Ivybridge Desktop 
OpenGL version string: 3.0 Mesa 8.0.4
OpenGL shading language version string: 1.30
WM: Gnome 3

PC.4
FF 19.0 (5 FPS)
Chrome 24.0.1297.0 dev (50 FPS)
Ubuntu 12.10
Intel Core Duo ~2GHz
3GB Ram
NVIDIA Corporation, GeForce 8600GT
WM: i3

Look like in my case manipulation with image data significant slowdown performance.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: