Split vs json
JavaScript performance comparison
Info
testing if splitting a string is faster than json decoding an array.
Preparation code
<script>
Benchmark.prototype.setup = function() {
var colString = "";
var preJson = [];
for(i=0;i<=10000;i++) {
colString += "publisher_" + i + ",";
preJson.push("publisher_" + i);
}
var json = JSON.stringify(preJson);
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
json decode |
|
pending… |
split |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments