Testingfloatarrays

JavaScript performance comparison

Test case created by onionhammer and last updated

Info

Test float32array

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var buffer = new Float32Array(12);
   
    function mapData(i) {
      return +i;
    }
};
</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
ArrayBuffer
var frequencies = ['.5', '.9', '1.8', '.5', '.9', '1.8', '.5', '.9', '1.8', '.5', '.9', '1.8'];

//Write to buffer
for (var i = 0, len = frequencies.length; i < len; ++i) {
  //Convert to number
  buffer[i] = +frequencies[i];
}

//Read from buffer
for (var i = 0, len = buffer.length; i < len; ++i) {
  buffer[i];
}
pending…
Normal Array
var frequencies = ['.5', '.9', '1.8', '.5', '.9', '1.8', '.5', '.9', '1.8', '.5', '.9', '1.8'];

//Write to buffer
for (var i = 0, len = frequencies.length; i < len; ++i) {
  //Convert to number
  frequencies[i] = +frequencies[i];
}

//Read from buffer
for (var i = 0, len = frequencies.length; i < len; ++i) {
  frequencies[i];
}
pending…
Array.map
var frequencies = ['.5', '.9', '1.8', '.5', '.9', '1.8', '.5', '.9', '1.8', '.5', '.9', '1.8'];

//Write to buffer
var converted = frequencies.map(mapData);

//Read from buffer
for (var i = 0, len = converted.length; i < len; ++i) {
  converted[i];
}
pending…

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

Compare results of other browsers

1 comment

Onion commented :

Shit, IE10 creams chrome in this test. Unexpected :D

Add a comment