IE10的画布性能优于Chrome

时间:2013-10-28 23:20:14

标签: javascript internet-explorer google-chrome canvas

我正在绘制一些线条和箭头,有时会在屏幕上显示一百多个,并且出于某种原因,IE10在这里的表现优于Chrome。如果我不画箭头,速度非常相似。所以,我推断它与IE10呈现线条与Chrome呈现线条的方式有关。

有没有人知道为什么会这样或任何可能加速Chrome的画布提示?

这一部分在被注释掉时会使Chrome更快,但似乎根本不会影响IE10:

        var risePercent2 = runPercent;
        var runPercent2 = -risePercent;
        var newX = targetX - (runPercent * (targetSize + arrowLength));
        var newY = targetY - (risePercent * (targetSize + arrowLength));
        context.moveTo(
            newX + (runPercent2 * arrowWidth),
            newY + (risePercent2 * arrowWidth)
        );
        context.lineTo(
            targetX - (runPercent * (targetSize + (arrowWidth / 2))),
            targetY - (risePercent * (targetSize + (arrowWidth / 2)))
        );
        context.lineTo(
            newX - (runPercent2 * arrowWidth),
            newY - (risePercent2 * arrowWidth)
        );

        context.strokeStyle = color;
        context.stroke();

1 个答案:

答案 0 :(得分:1)

可能只是因为IE在性能的至少一个方面抓住了Chrome: - )

然而,IE10和Chrome都可以使用GPU来加速渲染。确保在执行测试时为两个平台启用或禁用GPU支持

http://apmsystems.com/blog/?p=197

http://www.windowsvalley.com/how-to-enable-gpu-acceleration-or-gpu-rendering-in-google-chrome-8-or-higher/