Internet Explorer 8 中的 Raphael JS 性能

发布于 2024-12-10 16:58:23 字数 253 浏览 1 评论 0原文

Raphael 在 IE8 中的表现明显比在 IE7 或 IE6 中差。

例子: http://jsfiddle.net/t5NGF/

上面的示例在 IE8 中的渲染速度比 IE7 慢近 10 倍。激活IE8兼容模式,性能与IE7相当。

为什么使用 Raphael 时 IE8 比 IE7/IE6 慢很多?有什么办法可以提高性能吗?

Raphael's performance in IE8 is significantly worse than in IE7 or IE6.

Example:
http://jsfiddle.net/t5NGF/

The example above renders nearly 10 times slower in IE8 than in IE7. Activating IE8's compatibility mode, the performance matches IE7.

Why is IE8 so much slower than IE7/IE6 when using Raphael and is there anything to be done to improve the performance?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

合约呢 2024-12-17 16:58:23

不幸的是,对此您无能为力。

Raphael 在大多数浏览器中以 SVG 形式呈现图形,但在 IE6、IE7 和 IE8 下运行时以 VML 形式呈现。 VML 是 Microsoft 在 SVG 被定义为标准之前为 IE 创建的矢量图形语言。

坏消息是 IE8 的 VML 引擎比 IE6 和 IE7 中的引擎要慢得多,而 Raphael 中的某些功能对这些慢点的影响尤其严重。 IE8 中的矢量图形性能很差。这只是一个不幸的事实。

我在这里找到的提示建议您可能能够通过将 IE8 设置为使用其 IE7 兼容模式可以获得一些性能提升。我还没有尝试过,说实话,我犹豫是否建议这样做,因为有很多原因不想使用兼容模式,但 Raphael 在 IE8 中表现不佳的很大一部分原因是 < a href="http://ajaxian.com/archives/the-vml-changes-in-ie-8" rel="nofollow">在 IE7 和 IE7 之间对 VML 语言进行了一些相当重大的更改 IE8。进入兼容模式可能使浏览器切换到IE7版本的VML语言,从而避免这些问题。

正如我所说,如果可能的话,我会尽量避免使用此选项,因为兼容模式有很多问题,但如果您确实无法以其他方式使事情令人满意,您可以尝试一下。请注意,如果您确实使用此解决方案,请注意仅针对 IE8 激活它;如果你能避免的话,你真的不希望 IE9 或 IE10 进入 IE7 模式!

Unfortunately, there's not much you can do about this.

Raphael renders graphics in SVG for most browsers, but in VML when running under IE6, IE7 and IE8. VML is a vector graphics language that Microsoft created for IE before SVG had been defined as a standard.

The bad news is that IE8's VML engine is significantly slower than that in IE6 and IE7, and certain features in Raphael hit those slow spots particularly badly. Vector graphic performance in IE8 is bad. It's just an unfortunate fact.

A tip I found here suggests that you might be able to get some performance increase by setting IE8 to use its IE7-compatibility mode. I haven't tried it yet, and to be honest I hesitate to suggest this as there are any number of reasons not to want to do use compatibility mode, but a large part of the reason for Raphael's poor performance in IE8 is down to some fairly significant changes to the VML language that were made between IE7 and IE8. Going into compatibility mode might make the browser switch to the IE7 version of the VML language, and thus avoid those issues.

As I said, I'd try to avoid this option if at all possible, as compatibility mode has a lot of issues, but if you really can't make things work satisfactorily any other way, you could give it a try. Note, if you do use this solution, be careful to only activate it for IE8; you really don't want IE9 or IE10 going into IE7 mode if you can avoid it!

罪#恶を代价 2024-12-17 16:58:23

正确的方法是

<meta http-equiv="X-UA-Compatible" content="IE=7, IE=9">

因为 ie9 已经实现了 svg ,所以如果你写:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

那么 ie9 就会下降到 ie7

更多信息在 使用“X-UA-Compatible”为 IE8 模拟 IE7,但不为 IE9 模拟 IE7

the right way is

<meta http-equiv="X-UA-Compatible" content="IE=7, IE=9">

because ie9 had implemented svg ,so if you write :

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

then ie9 fall down to ie7

more info in Emulate IE7 for IE8 but not for IE9 using "X-UA-Compatible"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文