JSON.parse vs String.split (v13)

Revision 13 of this benchmark created on


Preparation HTML

<script>
  var arr = [ [23.5465,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[52.53454,35.34534,4.5345],[25.53454,3.34534,4.546546],[2.24,3.5345,45.5432436546],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546],[22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43],[23.56546,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[52.53454,35.34534,4.5345],[25.53454,3.34534,4.546546],[2.24,3.5345,45.5432436546],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546],[22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43],[23.654,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[52.53454,35.34534,4.5345],[25.53454,3.34534,4.546546],[2.24,3.5345,45.5432436546],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546],[22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546][22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43],[23.654,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[52.53454,35.34534,4.5345],[25.53454,3.34534,4.546546],[2.24,3.5345,45.5432436546],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546],[22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546],[22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43],[23.654,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[52.53454,35.34534,4.5345],[25.53454,3.34534,4.546546],[2.24,3.5345,45.5432436546],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546],[22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546][22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43],[23.654,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[52.53454,35.34534,4.5345],[25.53454,3.34534,4.546546],[2.24,3.5345,45.5432436546],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546],[22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546][22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43],[23.654,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[52.53454,35.34534,4.5345],[25.53454,3.34534,4.546546],[2.24,3.5345,45.5432436546],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546],[22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546][22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43],[23.654,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[52.53454,35.34534,4.5345],[25.53454,3.34534,4.546546],[2.24,3.5345,45.5432436546],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546],[22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546],[22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43],[23.654,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[52.53454,35.34534,4.5345],[25.53454,3.34534,4.546546],[2.24,3.5345,45.5432436546],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546],[22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546][22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43],[23.654,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[52.53454,35.34534,4.5345],[25.53454,3.34534,4.546546],[2.24,3.5345,45.5432436546],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546],[22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546][22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43],[23.654,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[52.53454,35.34534,4.5345],[25.53454,3.34534,4.546546],[2.24,3.5345,45.5432436546],[24.53454,35.34534,4.546546],[2.234343,3.3454534,4.546546][22.53454,32.34534,4.546546],[2.343,3.34534,4.5453],[22.2,3.34454534,4.43] ];
  var jsonstr = JSON.stringify(arr);
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
for toString
var resultJoin = ''; 
var subArr;
for (var i=0, il = arr.length ; i < il; i++ ){
  subArr = arr[i];
  for (var j=0, jl = subArr.length ; j < jl; i++ ){
    resultJoin += ',' + (subArr[j]).toString();
  }
  resultJoin += '-';
}
ready
JSON stringify
var resultJoin = JSON.stringify(arr);
ready

Revisions

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