Libraries & Frameworks

JavaScript performance library simpleperfo.js

January 30, 2016 JavaScript, Libraries & Frameworks 4 comments

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

 

TinyMCE count words plugin

August 27, 2015 Libraries & Frameworks 18 comments

Are you looking for a plugin that displays both characters and words count in TinyMCE ? You just found it. charwordcount is a plugin that allow you to count words in TinyMCE.

TinyMCE count words and characters plugin

The plugin count words in TinyMCE editor and additionally characters count. By default, the plugin ignores counting HTML tags and entities (like &nbsp;). If you need to count HTML tags and entities as well, you can enable that in the configuration. (more…)