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
Basic DOM operation: adding a listener to an element
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
/*
* Context here is an HTML5 document
* Appropriate build for this context would exclude XHTML support
* Next line asserts document will create an HTML DOM
* There are virtually no documents on the Web that create an XHTML DOM
*
*/
var API = { disableXmlParseMode:true };
</script>
<script src="//www.cinsoft.net/mylib099-min.js"></script>
<script>
// For My Library test
var attachListener = API.attachListener;
// For cross-browser test
// NOTE: Should use isHostMethod for host method detection
// Degrades below IE 9. Add attachEvent branch to support legacy versions.
// Could even be done in a script inside conditional comments. ;)
if (document.documentElement && document.documentElement.addEventListener) {
var attachEventListener = function(el, eventType, fn) {
el.addEventListener(eventType, fn, false);
};
}
// For all tests
var el1 = document.createElement('div');
var el2 = document.createElement('div');
var el3 = document.createElement('div');
var el4 = document.createElement('div');
var listenerFunction = function() {
var x = 1;
};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
My Library |
| ready |
My Library (OO) |
| ready |
jQuery |
| ready |
Cross-browser |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.