JavaScript performance library

Learn how to measure your JavaScript performance with my effective and super simple in use library. Simpleperfo.js is a JavaScript performance library that allows to measure execution times of your functions in order to allow you to optimize them effectively.

The library is very simple in use. My intention was to provide a library that will be easy to use even for JavaScript beginners. There are no difficult configurations or complicated APIs. Simply load the library to your existing project and use one of the available functions.

Below is an example code to measure two functions calculating Fibonacci numbers. Checking which one is faster is just matter of a few lines of simple code!

/* Algorithms to tests */
function fiboIterative(no) {
if(no<=2) { return 1; }
var a=1, b=1, sum=0;
for (var i=3; i<=no; i++) {
sum = a+b;
a = b;
b = sum;
}
return sum;
}

function fiboRecursive(no) {
if(no<=2) {
return 1;
} else {
return fiboRecursive(no-2) + fiboRecursive(no-1);
}
}

/* Measuring execution time */
var result1 = simpleperfo.executionTime(fiboIterative,[15]);
var result2 = simpleperfo.executionTime(fiboRecursive,[15]);

console.log("fiboIterative(15): " + result1 + "ms");
console.log("fiboRecursive(15): " + result2 + "ms");

This JavaScript performance library is available for download on simpleperfo.js on GitHub