How to test javascript performance time

First, create area where results will be output. You can adjust any style property to fit your needs. Minimum what you need to change is "parentNodeId":

// Test env
function testEnv() {
 var parentNode = document.getElementById("parentNodeId");
 if (parentNode) {
  var testNode = document.createElement("div"); = "testEnv"; = "7em"; = "white"; = "auto"; = "1px solid #778899"; = "left"; = "hidden"; = "nowrap";

Then, in the function or any piece of the code you are testing, write:
in the beginning:

var beginTime = new Date().valueOf();

and finally, at the end:

if (document.getElementById("testEnv"))
  document.getElementById("testEnv").innerHTML =
    "execution time: " +
    (new Date().valueOf()-beginTime)/1000 +
    " sec<br/>" +


Popular posts from this blog

Data visualization for Roadmap Microsite (Angular and D3.js)

Conceptual design

Four tools for prototyping: Sketch, Figma, Principle, and FramerX