1

I have a fairly extensive javascript that I can load in my Chrome (latest stable) and in IE11.

The load icon spins but the script eventually loads on my machine in both browsers.

I have 2 other people trying to load the page that contains the javascript in IE11 and they both cannot get the page to load. The loader icon spins forever and when they mouse over the refresh icon a flyout states "long running script"

How can I analyze my javascript to identify how and where the script is taking forever to load?

H. Ferrence
  • 7,906
  • 31
  • 98
  • 161

1 Answers1

4

Chrome's Developer Tools (F12) can profile your code. This will give you a lot of information -- possibly a lot of noise -- but it will identify two things for sure 1) functions where a lot of time is spent, and 2) functions that are called often.

This is the first place I'd start: turn on the profiler and reload the page.

If that doesn't give you a good place to start, look into the Chrome Timeline and console.timeStamp( 'Some Note' ). After you have started recording a timing session, every time the code encounters "console.timeStamp", it will annotate the timeline allowing you to estimate elapsed time between one or more points in your execution. See here: https://developers.google.com/chrome-developer-tools/docs/console#measuring_how_long_something_takes

J.D. Pace
  • 586
  • 1
  • 3
  • 17
  • I will...I am just now trying to figure out where to look and how to interpret @JDPace – H. Ferrence Apr 06 '14 at 20:27
  • @H.Ferrence "Profiles" and "Timelines" would be the place to look. "Network" may give some info, but I don't think it will tell you anything you don't already know. One more thought: If your JavaScript exectutes after the page is loaded, and some resources (like images) take a long time to load, the JS won't start until everything else is loaded. The "Network" section may expose something like this. – J.D. Pace Apr 06 '14 at 21:05
  • @H.Ferrence: what did you find out? – J.D. Pace Jul 30 '14 at 03:06