Open Bug 703281 Opened 9 years ago Updated 9 years ago

Canvas stroke performance is super-linear in number of points in the path


(Core :: Canvas: 2D, defect)

11 Branch
Not set





(Reporter: oleg, Unassigned)


(Whiteboard: [cairo path stuff])

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0a1) Gecko/20111117 Firefox/11.0a1
Build ID: 20111117030939

Steps to reproduce:

Drawing a line with a lot of points is terribly slow. More over, time for drawing line between two points increase while increasing points in chart.

Actual results:


ops (from jsperf) — line redraws per second;
t = (1/ops * 10e6)/dots — how long to draw line between interconnected points (in us);

On my machine (Linux, 64bit):

Mozilla/5.0 (X11; Linux x86_64; rv:11.0a1) Gecko/20111116 Firefox/11.0a1
250 dots:  ops=141    t=28 us
500 dots:  ops=82.42  t=24 us
750 dots:  ops=49.57  t=27 us
1000 dots: ops=32.44  t=31 us
2000 dots: ops=10.58  t=47 us
3000 dots: ops=5.76   t=58 us
Opera 11.51
250 dots:  ops=204    t=20 us
500 dots:  ops=131    t=15 us
750 dots:  ops=104    t=13 us
1000 dots: ops=86.16  t=12 us
2000 dots: ops=39.63  t=13 us
3000 dots: ops=28.68  t=12 us

On Windows machine a bit different results, but increasing too:
250  dots: t=80 us
500  dots: t=92 us
750  dots: t=101 us
1000 dots: t=103 us
2000 dots: t=106 us
3000 dots: t=105 us

Expected results:

The value `t' shouldn't grow while increase `dots'.
On Mac, I get these values:

250 dots:  ops=865    t=4.6 us
500 dots:  ops=521    t=3.8 us
750 dots:  ops=395    t=3.4 us
1000 dots: ops=315    t=3.2 us
2000 dots: ops=174    t=2.9 us
3000 dots: ops=121    t=2.8 us

So this looks like yet another cairo path issue...
Summary: stroke degradate on many lineTo()'s → Canvas stroke performance is super-linear in number of points in the path
Whiteboard: [cairo path stuff]
Ok, I add related bug in cairo bugtracker:
Cairo quite stable on the range 1000..3000 points. Firefox on that range slowed down to 2 times.
#568526 looks like related bug.
You need to log in before you can comment on or make changes to this bug.