Compact script to calculate JavaScript execution time
Here is an object literal version of a script to calculate JavaScript execution time. It may be useful in development to compare the performance of different scripts. The advantage of the object literal version is that it is compact and should not interfere with existing script function names.
var timeDiff = {
setStartTime:function (){
d = new Date();
time = d.getTime();
},
getDiff:function (){
d = new Date();
return (d.getTime()-time);
}
}
Use it as follows: call timeDiff.setStartTime() at the start of your script and call timeDiff.getDiff() at the end. The timeDiff.getDiff() function will return the script execution time.
Visit http://franca.exofire.net/jq/ for more JavaScript tips.
Thank you for this post.
Comment by Ramesh Babu Yarru — October 7, 2009 @ 12:25 pm
This can be incumbent to accomplish a perfect range thesis when people study at the high school. Hence, your great issue related to this post would be a very good sample for the thesis paper writers.
Comment by Elisabetta21 — December 21, 2009 @ 1:27 am