JSFiddle - React, Tailwind, and code Playground

by octavioamu

HTML

<div id="work"></div>

JavaScript

///////////////// (VALID?) BENCHMARK  /////
var simplecron = {
    stime: new Date(), // start time 
    restart: function () {
	this.stime = new Date();
    },
    duration: function () {
	var end = new Date();
	return end - this.stime;
    }
}
// BY JQUERY
simplecron.restart(); for (var i=1; i<3000; i++) 
    $("#work").html('BENCHMARK WORK');
var html_time = simplecron.duration();
simplecron.restart(); for (var i=1; i<3000; i++) 
    $("#work").text('BENCHMARK WORK');
alert("JQ TIMES (3000x): \nhtml="+html_time+"\ntext="+simplecron.duration());
// BY PURE JAVASCRIPT
simplecron.restart(); for (var i=1; i<3000; i++)
        $("#work")[0].innerHTML = 'BENCHMARK WORK';
var html_time = simplecron.duration();
simplecron.restart(); for (var i=1; i<3000; i++) 
        $("#work")[0].nodeValue = 'BENCHMARK WORK';
alert("JS TIMES (3000x): \nhtml="+html_time+"\ntext="+simplecron.duration());