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
Compare getting a particular cookie from document.cookie using either a regex or indexOf
<script>
document.cookie="TEST_COOKIE=RegEx_vs_indexOf";function getCookieRegEx(c,a){var b=a.match(RegExp(c+"=([^;]*)"));return b&&b.length>0?b[1]:""}function getCookieIndexOf(c,a){var c=" "+c+"=",b,a=" "+a+";";return(b=a.indexOf(c))>=0?(b+=c.length,a=a.substring(b,a.indexOf(";",b))):""};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Get Cookie RegEx |
| ready |
Get Cookie IndexOf |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.