2011-06-11 36 views
1

我們使用html5的元素+ JavaScript實現了圖形繪製。 View it herehtml5 <canvas> Opera 11極其緩慢?

它工作在鉻12,火狐3.6和4,以及在Opera用鼠標交互時(懸停和滾動到縮放)或具有開關特性時11.

拉伸速度是在細Chrome和Firefox圖形控件。但在Opera 11.11 it 需要年齡重繪。我嘗試了兩種不同的機器,一種使用Windows,另一種使用Linux。

任何想法,爲什麼這是這樣嗎?或者我怎麼能夠找出問題所在?

+1

您可能想要閱讀本文,並查看探查器代碼是否可以幫助您發現減速的位置。 http://www.webmasterkb.com/Uwe/Forum.aspx/opera/6346/Opera-slow-with-certain-Javascript-sites – 2011-06-12 02:09:09

+0

感謝您的提示 - 我會給你一個upvote,但你沒有作爲回答發佈,但作爲評論。 – fabb 2011-06-13 10:12:20

+0

我很高興你發現了這個問題。我沒有答案,這就是爲什麼它是一個評論,但它引導了你,這是目標。 – 2011-06-13 12:50:20

回答

3

對於Opera中的每個〜200層,使用context.globalCompositeOperation = "destination-over";填充每個路徑需要35ms。

幸運的是,有一種方法可以在不破壞視覺效果的情況下使用context.globalCompositeOperation = "source-over";,從而使速度更接近Firefox和Chrome瀏覽器。

我發現通過使用由簡碼的啓發以下兩行,詹姆斯黑棋貼的鏈接:

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 

需要注意的是Chrome瀏覽器(WebKit的)已經在JavaScript探查器內置,並在Firefox Firebug Extension還可以輕鬆進行分析。但是我沒有發現類似Opera的東西。