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
This test benchmarks JSON 3 against other JSON implementations.
The following implementations support parsing and serializing:
eval
and a series of validation RegExps.The following implementations only support parsing:
json-parse
: Uses a character-based recursive descent parser.json-parse-state
: Uses a state machine parser.json-sans-eval
: Uses a non-validating RegExp.evalJSON
: Uses a RegExp-based recursive descent parser.<!-- JSON 3 v3.2.2 -->
<script>
// Disable the native JSON implementation.
this.JSON = null;
</script>
<script src="http://bestiejs.github.com/json3/lib/json3.min.js"></script>
<!-- JSON 2 -->
<script>
// Set up JSON 2.
this.JSON3 = this.JSON;
this.JSON = null;
</script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js"></script>
<script>
this.JSON2 = this.JSON;
this.JSON = null;
</script>
<!-- `json-parse-state` (Crockford's state machine parser) -->
<script src="http://dl.dropbox.com/u/43343137/json_parse_state.js"></script>
<script>
// `json-parse` is exposed via the `json_parse` function as well.
this.json_parse_state = this.json_parse;
</script>
<!-- `json-parse` (Crockford's recursive descent parser) -->
<script src="http://dl.dropbox.com/u/43343137/json_parse.js"></script>
<!-- Mike Samuel's `json-sans-eval` -->
<script src="http://json-sans-eval.googlecode.com/svn/trunk/src/json_sans_eval.js"></script>
<!-- Asen Bozhilov's `evalJSON` -->
<script src="http://dl.dropbox.com/u/43343137/evalJSON.js"></script>
<!-- JSON3 charCodeAt -->
<script>
this.JSON = null;
</script>
<script src="https://rawgithub.com/oxyc/5216245/raw/4088b40275101b4372c49e2da26e4d64c479a393/json3opt.js"></script>
<script>
// Set up JSON 3 charCodeAt
this.JSON3opt = this.JSON;
this.JSON = null;
</script>
<script src="https://rawgithub.com/oxyc/5216638/raw/0a359cdf21600b7e7b84616d673cf888f2a7de00/json3opt.js"></script>
<script>
// Set up JSON 3 charCodeAt + StringAddStub opt
this.JSON3opt2 = this.JSON;
this.JSON = null;
</script>
var value = '{"kitcambridge":"Kit","contributors":{"jdalton":"John-David","mathias":"Mathias"},"list":[1,2,3],"number":5,"date":"2012-04-25T14:08:36.879Z","boolean":true,"nil":null}';
Ready to run.
Test | Ops/sec | |
---|---|---|
JSON 3: parse |
| ready |
JSON 2: parse |
| ready |
json-parse-state |
| ready |
json-parse |
| ready |
json-sans-eval |
| ready |
evalJSON |
| ready |
JSON3 charCodeAt |
| ready |
JSON3 charCodeAt + stringAddStub |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.