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
Getting the value of nested form elements.
<style>
.h {
display: none;
}
</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="formEdit">
<div>
<input class="t" type="text" value="first" />
<input style="display:none;" class="t h" type="text" value="second" />
<input style="display:none;" class="t h" type="text" value="third" />
</div>
</div>
<script>
// Cross-browser getElementsByClassName
// taken from http://ejohn.org/blog/getelementsbyclassname-speed-comparison
function getElementsByClassName(oElm, strTagName, strClassName) {
var arrElements = (strTagName == "*" && oElm.all) ? oElm.all : oElm.getElementsByTagName(strTagName);
var arrReturnElements = new Array();
strClassName = strClassName.replace(/\-/g, "\\-");
var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
var oElement;
for (var i = 0; i < arrElements.length; i++) {
oElement = arrElements[i];
if (oRegExp.test(oElement.className)) {
arrReturnElements.push(oElement);
}
}
return (arrReturnElements)
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
@Pinkie |
| ready |
@corroded |
| ready |
@corroded's second test |
| ready |
@me (jQuery) |
| ready |
@me (pure JS) |
| ready |
@me (pure JS, HTML5y, no inline CSS) |
| ready |
@me (functionally identical to original) |
| ready |
@me (cross-browser getElementsByClassName) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.