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
http://stevenbenner.com/2010/03/javascript-regex-trick-parse-a-query-string-into-an-object/
<script>
var query = 'http://your.domain/product.aspx?category=4&product_id=2140&query=lcd+tv';
function split() {
var queryString = {};
query.split("?").pop().split("&").forEach(function (prop) {
var item = prop.split("=");
queryString[item.shift()] = item.shift();
});
return queryString;
}
function regex() {
var queryString = {};
query.replace(/([^?=&]+)(=([^&]*))?/g, function ($0, $1, $2, $3) {
queryString[$1] = $3;
});
return queryString;
}
function regexp() {
var queryString = {};
query.replace(new RegExp("([^?=&]+)(=([^&]*))?", "g"), function ($0, $1, $2, $3) {
queryString[$1] = $3;
});
return queryString;
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
regex |
| ready |
split |
| ready |
regexp |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.