json2 vs jquery json
JavaScript performance comparison
Info
native json.stringify() vs json2.stringify() vs json3.stringify() vs jquery.json.toJSON()
Preparation code
<script>
this.JSONNATIVE = this.JSON;
this.JSON = false;
</script>
<script src="http://www.x-non.com/json/json2.min.js"></script>
<script>
this.JSON2 = this.JSON;
this.JSON = false;
</script>
<script src="http://www.x-non.com/json/json3.min.js"></script>
<script>
this.JSON3 = this.JSON;
this.JSON = false;
</script>
<script src="http://www.x-non.com/json/jquery-1.9.1.min.js"></script>
<script
src="http://www.x-non.com/json/jquery.json-2.4.min.js"></script>
<script>
Benchmark.prototype.setup = function() {
var value = {
kitcambridge: "Kit",
contributors: {
jdalton: "John-David",
mathias:"Mathias"
},
list: [1,2,3],
number: 5,
date: "2012-04-25T14:08:36.879Z",
bln: 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 | |
|---|---|---|
json native |
|
pending… |
json 2 |
|
pending… |
json3 |
|
pending… |
jquery.json |
|
pending… |
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:
- Revision 1: published
- Revision 2: published
- Revision 3: published
0 comments