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
document.cookie="testCookie=Foo Bar; expires=Thu, 01 Dec 2099 12:00:00 UTC; path=/";
document.cookie="anotherTestCookie=Baz Qux; expires=Thu, 01 Dec 2099 12:00:00 UTC; path=/";
function getCookieValueByRegEx(a, b) {
b = document.cookie.match('(^|;)\\s*' + a + '\\s*=\\s*([^;]+)');
return b ? b.pop() : '';
}
function getCookieValueByArrayFunctions(a, b, c) {
b = '; ' + document.cookie;
c = b.split('; ' + a + '=');
return !!(c.length - 1) ? c.pop().split(';').shift() : '';
};
function getCookieValueByLoop(a, b, c, d, e) {
b = document.cookie.split('; ');
for (e = b.length - 1; e >= 0; e--) {
c = b[e].split('=');
if (a === c[0]) return c[1];
}
return '';
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Get Cookie Value By Loop |
| ready |
Get Cookie Value By Regex |
| ready |
Get Cookie Value By Array Functions |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.