Saturday 15 February 2014

javascript - multiple document.ready()'s performance metrics -


I have many javascript files that meet and run in run-time, with 10+ developers There are documents for an enterprise application. More than 5 seconds JavaScript works in all places due to loading. I need more help in finding out where the obstacles are gradually removed and removed from the piece of functionality.

Example

file1.js

$ (document) .ready (function () {// code of 100 lines of 100}};

file2.js

  // For 100 lines ... $ (document) .ready (function () {// lines of code 100}}}; // lines of 100 ...  

I would like to include some type of metric, so I slowly - I can comment on different things and see what the difference is actually in. Originally for the document which takes the whole time, i One way to monitor is to run first.

I am thinking that I can use jQuery to complete it, maybe change all $ (document). To use the jquery wrapper in the project, and then put a timer. Alternatively, I can run a function as a long time before starting the timer (before joining a joint / minted file). I'm not sure when she can stop the timer and display any thoughts?

Edit: I know that firebug can get it, but I am working on a huge enterprise application and the firebug is unfortunately not an option for me at this time. is. I'm actually hoping to attach a number to HTML Example:

Document. Time: 653ms

I think the first thing you should do is to fire the firebug or safari profiler and see What exactly is taking time.

After this, you can get more information about load speed barriers by using Page-Speed ​​and YSLlo.

Just being more than one listener on the document. In fact, things should not be slow down - it's obviously either the code that runs on those listeners or the amount of code you are loading.


No comments:

Post a Comment