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
<div id="iddiv">
<div class="inside"></div>
<div class="inside"></div>
</div>
<div class="classdiv"></div>
<script>
window.$=function(a){var b={"#":"getElementById",".":"getElementsByClassName","@":"getElementsByName","=":"getElementsByTagName","*":"querySelectorAll"}[a[0]];return document[b](a.slice(1))};
// Michał Wachowski
window.$$ = function(s) {
return document[{
'#': 'getElementById',
'.': 'getElementsByClassName',
'@': 'getElementsByName',
'=': 'getElementsByTagName'}[s[0]]
|| 'querySelectorAll'](s.slice(1))
};
// Tomasz Żełudziewicz
window.$$$ = function(s) {
try {return document[{
'#': 'getElementById',
'.': 'getElementsByClassName',
'@': 'getElementsByName',
'=': 'getElementsByTagName',
'?': 'querySelectorAll'
}[s[0]]](s.slice(1));}catch(e){}
};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Original regex |
| ready |
return string[0] in document |
| ready |
try/catch return |
| ready |
document gets |
| ready |
querySelector |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.