Decoding ASCII string from binary blob

JavaScript performance comparison

Test case created by Brandon Jones

Preparation code



      
<script>
Benchmark.prototype.setup = function() {
  var charBlob = new Uint8Array([65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90]);

};
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
For loop
var i, l = charBlob.len;
var result = '';
for(i = 0; i < l; ++i) {
  result += String.fromCharCode(charBlob[i]);
}
pending…
Apply
var result = String.fromCharCode.apply(String, charBlob);
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.

0 Comments