JSON2 vs JSON3 Strinfigy
JavaScript performance comparison
Preparation code
<!-- 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>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script>
Benchmark.prototype.setup = function() {
var test_json = {"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};
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
JSON2.stringify |
|
pending… |
JSON3.stringify |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments