jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
<script>
function clearMessages()
{
var node = document.getElementsByTagName('body')[0];
node.innerHTML = "";
}
function appendMessage(html)
{
var node = document.getElementsByTagName('body')[0];
var range = document.createRange();
range.selectNode(node);
var documentFragment = range.createContextualFragment(html);
node.appendChild(documentFragment);
if (getNumberOfMessages() > 250)
{
removeFirstMessage();
}
}
function removeFirstMessage()
{
var node = document.getElementsByTagName('body')[0];
node.removeChild(node.firstChild);
}
function getNumberOfMessages()
{
var kids;
var realKids;
var parent;
var i = 0;
realKids = 0;
parent = document.getElementsByTagName('body')[0];
kids = parent.childNodes.length;
return kids;
//while(i < kids){
////if(parent.childNodes[i].nodeType != 3) //whitespace
//if(parent.childNodes[i].tagName.toLowerCase() == 'div')
//{
// realKids++;
//}
//i++;
//}
//return realKids;
}
function updateMessageState(id,stateText,messageText)
{
var node = document.getElementById(id);
if (node == null)
{
return;
}
var statusNode = node.getElementsByTagName('div')[4];
if (stateText.length == 0)
{
node.setAttribute('class', 'message outgoing');
statusNode.setAttribute('class', 'status');
}
else
{
node.setAttribute('class', 'message outgoing ' + stateText);
statusNode.setAttribute('class', 'status ' + stateText);
}
statusNode.innerHTML = messageText;
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
append |
| ready |
append2 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.