Skip to content

Instantly share code, notes, and snippets.

@tirams
Created February 29, 2012 15:23
Show Gist options
  • Save tirams/1941560 to your computer and use it in GitHub Desktop.
Save tirams/1941560 to your computer and use it in GitHub Desktop.
add timing to a js page to test performance
// with jQuery on the page do the nezt line in the debugger to include the timer scripts
jQuery.getScript("http://remysharp.com/time.packed.js")
time.func(funcname);
time.stop('nameforeport')
time.start('nameforreport')
//----------------------- DOC ----------------
// see http://remysharp.com/2007/04/20/performance-profiling-javascript/
Synxtax
time.func(testFunction);
element.onclick = time.func(function() {
// do something
});
element.onclick = testFunction2;
time.event(element, 'click');
time.start('pageLoad');
// page loads and JS runs
time.stop('pageLoad');
time.report(); // show report
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment