JSON.parse vs split

Benchmark created by Ian on


Preparation HTML

<script>
  var json = '["bacon", "eggs", 2, 48, 2810.12983472, 37371.12083482]';
  var piped = JSON.parse(json).join('|');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
JSON.parse()
JSON.parse(json);
ready
Custom
var parts = piped.split('|');
var a = parseInt(parts[2]);
var b = parseInt(parts[3]);
var c = parseFloat(parts[4]);
var d = parseFloat(parts[5]);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.