开发者

html5 <canvas> extremely slow on Opera 11?

We implemented graph drawing with html5's element + JavaScript. View it here.

It works in Chrome 12, Firefox 3.6 and 4, and in Opera 11.

The drawing speed is fine in Chrome and Firefox when interacting with the mouse (hover and scroll to zoom) or when switching properties with the graph controls. But in Opera 11.11 it takes ages to redraw. I tried on two different machines, one with Windows and the other with Linux.

Any ideas why开发者_运维技巧 this is so? Or how I could find out what the problem is?


Filling each path with context.globalCompositeOperation = "destination-over"; took 35ms for each of the ~200 layers in Opera.

Fortunately there was a way I could use context.globalCompositeOperation = "source-over"; without destroying the visual, making the speed way closer to the one in Firefox and Chrome.

I found out by using the following two lines inspired by the profiler code, James Black posted a link to:

time=new Date().getTime(); //this line before the code block to test
//code block under test
time=new Date().getTime() - time; opera.postError(time +'ms'); //this line after the code block to test

Note that Chrome (Webkit) already has a built in JavaScript profiler, and in Firefox the Firebug Extension also allows easy profiling. But I didn't find anything similar for Opera.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜