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
<script src="http://ajax.googleapis.com/ajax/libs/ext-core/3/ext-core.js"></script>
<script src="http://cdn.sencha.com/ext/gpl/5.0.1/build/ext-all.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://json-sans-eval.googlecode.com/svn/trunk/src/json_sans_eval.js"></script>
<script>
var mystr='{"Mandatory":"OK","Optional":"KO"}';
var invalid='{Mandatory:"OK",Optional:"KO"}';
var fix1 = /\{(\s*[a-zA-Z0-9_]+\s*):/mg;
var fix2 = /,(\s*[a-zA-Z0-9_]+\s*):/mg;
function parseOrEval(value) {
if(/\{\s*[a-zA-Z0-9_]+\s*:/.test(value) || /,\s*[a-zA-Z0-9_]+\s*:/.test(value)) {
return eval('(' + value + ')');
}
else {
return JSON.parse(value);
}
}
function parseOrEval2(value) {
if(/\{\s*[a-zA-Z0-9_]/.test(value) || /[a-zA-Z0-9_]\s*:/.test(value)) {
return eval('(' + value + ')');
}
else {
return JSON.parse(value);
}
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
JSON Parser |
| ready |
eval |
| ready |
jQuery |
| ready |
function |
| ready |
Ext core |
| ready |
ExtJs 5.0.1 |
| ready |
json-sans-eval |
| ready |
JSON Parser & Fixed JSON |
| ready |
parseOrEval - parse |
| ready |
parseOrEval - eval |
| ready |
parseOrEval2 - parse |
| ready |
parseOrEval2 - eval |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.