JSON vs String (v14)

Revision 14 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],[23.5465,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[23.5465,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[23.5465,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[23.5465,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[23.5465,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[23.5465,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[23.5465,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[23.5465,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[23.5465,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[23.5465,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[23.5465,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[23.5465,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[23.5465,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[23.5465,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545],[23.5465,3.34534,4.5345345],[25.53454,3.34534,4.546546],[26.53454,3.45454,45.545]];

</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; j++ ){
    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.