What methods can I use to play sporadic IE "A script on this page slows down Internet Explorer"?

I am trying to replicate the error that the client reported, this β€œthis script is running slow” notification that appears in IE due to its extremely slow JS / DOM parsing.

This does not happen on my IE6 virtual box (the client has IE6) and it does not work on the test computer that I have (some mac mini).

I can guarantee that there is a lot of JS going on, and there a lot of HTML is processed after extraction using XHR, in addition, after that a lot of JS works on the added DOM elements. I cannot publish the whole script, but I am sure that I could easily track the problem, but I want to reproduce this in order to play with its optimization.

This is a really upscale client, so I can’t just talk to the phone or talk to them. Is there a way to slow down the machine to reproduce this error? Or should I just ask for client computer specifications and try to access an older computer that will be more likely to reproduce the problem? Or even use something like a browser?

Another idea that I was thinking about would be that would make JS work even harder so that I get this problem and try to optimize my code, so even with my extra code it won't send a script error notification.

I would be grateful for any advice.

+7
javascript debugging
source share
3 answers

There are many things you can do to slow down your computer. The real issue here is whether you want it to be accurate, or just something that digests a sufficient processor cycle so that IE6 can reproduce this problem more often.

Starting with rude and simple methods: using a virtual machine, give it only one processor, and then run something with high CPU consumption, for example, playing a movie. Try using something that doesn't use too much RAM, because getting IE into the page file will not help you here. To achieve a more accurate slowdown, you may want to warm up your processor, although doing this for the sake of debugging Javascript is a bit extreme. Gaining access to an old computer can also do the trick, although none of them are guaranteed to reproduce the problem.

Using screen sharing software can also be difficult - it depends on how the client wants to install and configure such software, but it will certainly help reproduce the error. To play with it while you use client computer time is likely to be unacceptable.

There are other things you can try besides slowing down your computer. In fact, you can manually limit the time for warning IE to slow script according to this Microsoft support article by changing some registry values. Try deep Javascript profiling on your own machine, even if you cannot generate a slow script error, you can still find bottlenecks or places where the script is not working well.

+4
source share

run inside the virtual machine and lower the memory to have redundant replacement. If this still does not work, you can run some control SW in the background, which, as a rule, chews a lot of CPU.

+5
source share

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 what you want to fix if they want it to be fixed.


Otherwise, if you have any idea about the problem, you can:

  • create an XML / HTML document using random information and save it in a string
  • then try and parse this with XMLDom or something.

You should try to do this with a million lines:

 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 complex as you like using random elements, etc.

+1
source share

All Articles