Your site is too slow to load or too slow to respond to clicks and other user interaction,and you don’t know why. What part of the code is taking so much time?
Use a profiler, either one of the many available ones or a simple one you can code yourself.
There are also some profilers specific to jquery that you can find with a web search for jquery profiler. These let you profile selector performance and look more deeply at jQuery function performance.
For really detailed profiling, where you need to analyze individual sections of code smaller than the function level, you can write a simple profiler in just a few lines of code. You may have coded this ad hoc classic:
We can make something more general-purpose and easier to use with only 15 lines of code:
Now we have a time() function that we can call as often as we want to log the elapsed time since the last time() call (or, optionally, since a specific prior time). When we’re ready to report the results, we call time.done(). Here’s an example:
We can see that the largest amount of time is being spent between the time('first')
For many optimization exercises, this code may be sufficient. But what if the code we need to test is inside a loop?
Now our little profiler will list those first, second, and third entries 10 times each! That’s not too hard to fix—we just need to accumulate the time spent for each specific message label when it’s called multiple times:
With this change, we’ll get useful results from that loop:
J Query Related Interview Questions
|HTML 4 Interview Questions||HTML Interview Questions|
|HTML 5 Interview Questions||Zend Interview Questions|
|JqueryUI Interview Questions||Dynamic HTML Interview Questions|
|XQuery Interview Questions||jQuery Mobile Interview Questions|
J Query Related Practice Tests
|HTML 4 Practice Tests||HTML Practice Tests|
|HTML 5 Practice Tests||Zend Practice Tests|
|PHP and Jquery Practice Tests||J Query Practice Tests|
|CodeIgniter Practice Tests||Dynamic HTML Practice Tests|
J Query Tutorial
Selecting Elements With Jquery
Beyond The Basics
Faster, Simpler, More Fun
Html Form Enhancements From Scratch
Html Form Enhancements With Plugins
Interface Components From Scratch
User Interfaces With Jquery Ui
Jquery Ui Theming
Jquery, Ajax, Data Formats: Html, Xml, Json, Jsonp
Using Jquery In Large Projects
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.