我可以使用什么方法来重现 IE 偶尔出现的“此页面上的脚本导致 Internet Explorer 运行缓慢”的问题?通知?

发布于 2024-09-18 06:05:27 字数 475 浏览 8 评论 0原文

我正在尝试复制客户端报告的错误,这是由于 JS/DOM 解析速度极慢而出现在 IE 中的“此脚本运行缓慢”通知。

这不会发生在我的 virtualbox IE6(客户端有 IE6)上,也不会在我拥有的测试机(一些 mac mini)上工作。

我可以保证,虽然有很多 JS 发生,并且使用 XHR 检索后有很多 HTML 正在处理,此外还有很多 JS 对附加的 DOM 元素进行操作。我不可能发布整个脚本,但我相信我可以轻松地找到问题,但我想重现此问题以对其进行优化。

这是一个非常高调的客户,所以我不能只通过电话或即时消息与他们交谈。有什么方法可以减慢我的机器的速度以重现此错误?或者我应该继续询问客户的计算机规格并尝试访问较旧的计算机,这样更有可能重现问题?或者甚至使用浏览器摄像头之类的东西?

我想到的另一个想法是,让 JS 运行得更多,以便我确实遇到问题并尝试优化我的代码,这样即使使用我的附加代码,它也不会发布脚本通知错误。

我将不胜感激任何建议。

I'm trying to replicate a bug which the client has reported, it's the "this script is running slow" notification which appears in IE due to it's extremely slow JS/DOM parsing.

This doesn't occur on my virtualbox IE6 ( client has IE6 ) nor does it work on a test machine I have ( some mac mini ).

I can guarantee that there's a lot of JS happening though, and there's lots of HTML being processed after being retrieved using XHR, in addition a lot of JS operating on the appended DOM elements after that. I can't possibly post the entire script, but I'm confident I could easily track the issue down but I want to reproduce this to play around with optimizing it.

This is a really high profile client so I can't just get on the phone or IM and speak to them. Are there any ways I could slow down my machine in order to reproduce this bug? Or should I just stick to asking for the client's computer specifications and try to get access to an older computer which would have a more likely chance of reproducing the issue? Or even use something like browsercam?

Another idea I thought about would be sort of, making the JS operate even more, in order so I do get the issue and try to optimize my code so even with my additional code it won't post the script notification error.

I'd appreciate any advice.

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

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

发布评论

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

评论(3

匿名。 2024-09-25 06:05:27

在虚拟机内运行,并故意降低内存以获得过多的交换。如果这仍然不起作用,您可以在后台运行一些基准测试软件,这些软件往往会占用大量 CPU。

run inside a VM, and lower the memory on purpose to have excess swapping. If this still doesn't work, you can run some benchmarking SW in the background, those tends to chew a lot of CPU.

简单气质女生网名 2024-09-25 06:05:27

有很多方法可以降低计算机的速度。这里真正的问题是您是否希望它是精确的,或者只是消耗足够的 CPU 周期以使 IE6 更频繁地重现此问题。

从粗略和简单的方法开始:使用虚拟机,只给它一个CPU,然后运行一些CPU使用率高的东西,比如播放电影。尝试使用不会占用太多 RAM 的东西,因为强制 IE 进入页面文件不会对您有帮助。为了获得更精确的减速效果,您可能需要对 CPU 进行降频,尽管为了调试 Javascript 而这样做有点极端。使用旧计算机也可以解决问题,尽管这些方法都不能保证重现问题。

使用屏幕共享软件也可能很困难 - 这取决于客户安装和设置此类软件的意愿,但这肯定有助于重现该错误。然而,当您耗尽客户计算机的时间时却不得不使用它可能是不可接受的。

除了减慢计算机速度之外,您还可以尝试其他方法。实际上,您可以根据此Microsoft 支持文章,通过更改一些注册表值。尝试在您自己的计算机上深度分析 Javascript,即使您无法生成缓慢的脚本错误,您仍然可以找到瓶颈或脚本执行不良的地方。

There are a lot of things that can be done to slow down your computer. The real issue here is whether you want it to be precise, or just something that chews up enough CPU cycle to enable IE6 to reproduce this issue more frequently.

Starting with the rough and simple methods: Using the Virtual Machine, give it only one CPU, then run something with high CPU usage, like playing a movie. Try to use something that does not use up too much RAM, because forcing IE into the pagefile won't help you here. To get more precise slowing, you might want to underclock your CPU, although doing this for the sake of debugging Javascript is a little extreme. Getting access to an old computer may also do the trick, although none of these are guaranteed to reproduce the problem.

Using screen sharing software may also be difficult - it depends on how willing the client is to installing and setting up software like that, but this should definitely help reproduce the bug. To have to play around with it while you use up the client's computer's time though will probably be unacceptable.

There are other things you can try, in addition to slowing down the computer. You can actually manually lower the time limit for the IE slow script warning, according to this Microsoft support article, by changing some registry values. Try deep profiling the Javascript on your own machine, even if you cannot generate the slow script error, you can still find bottlenecks or places where the script performs badly.

罪#恶を代价 2024-09-25 06:05:27

我发现你的问题:
这是一个非常高调的客户,所以我不能只是通过电话或即时消息与他们交谈。 - 这是您想要解决的问题,如果他们想要解决的话。


否则,如果您对问题有所了解,您可以:

  • 使用随机信息创建一个 XML/HTML 文档并将其存储在字符串中
  • ,然后尝试使用 XMLDom 或其他内容解析它

您应该尝试使用一百万行来执行此操作:

sXML     = "<?xml version="1.0" encoding="UTF-8"?>\n<rootElement>\n";
for (var i=0;i<1000000;i++){
   sXML += '<element name="' + Math.floor(Math.random()*10001) + '">' 
         +    'some more random text: ' + Math.floor(Math.random()*1001) 
         + "</element>\n";
}
sXML     = "</rootElement>";

var oXML = (new DOMParser()).parseFromString(sXML, "text/xml");
var root = oXML.documentElement;

当然您可以使用随机元素等将其制作得像您想要的那样复杂。

I found your problem:
This is a really high profile client so I can't just get on the phone or IM and speak to them. - this is something that you're going to want to fix, if they want it fixed.


Otherwise, if you have some idea of the problem, you could:

  • create a XML/HTML document using random information and store it in a string
  • then try and parse that using XMLDom or something

You should try doing it with a million rows:

sXML     = "<?xml version="1.0" encoding="UTF-8"?>\n<rootElement>\n";
for (var i=0;i<1000000;i++){
   sXML += '<element name="' + Math.floor(Math.random()*10001) + '">' 
         +    'some more random text: ' + Math.floor(Math.random()*1001) 
         + "</element>\n";
}
sXML     = "</rootElement>";

var oXML = (new DOMParser()).parseFromString(sXML, "text/xml");
var root = oXML.documentElement;

Of course you can make it as elaborate as you want, using random elements, etc.

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