float32arraytest

Benchmark created on


Setup

var a = new Float32Array(16);
    for(var i = 0; i<a.length; i++){
    a[i] = i;
    }
    Float32Array.prototype.copy = function(){
    var b = new Float32Array(16);
    b[0] = this[0];
    b[1] = this[1];
    b[2] = this[2];
    b[3] = this[3];
    b[4] = this[4];
    b[5] = this[5];
    b[6] = this[6];
    b[7] = this[7];
    b[8] = this[8];
    b[9] = this[9];
    b[10] = this[10];
    b[11] = this[11];
    b[12] = this[12];
    b[13] = this[13];
    b[14] = this[14];
    b[15] = this[15];
    return b;
    }
    function copy(a){
    var b = new Float32Array(16);
    b[0] = a[0];
    b[1] = a[1];
    b[2] = a[2];
    b[3] = a[3];
    b[4] = a[4];
    b[5] = a[5];
    b[6] = a[6];
    b[7] = a[7];
    b[8] = a[8];
    b[9] = a[9];
    b[10] = a[10];
    b[11] = a[11];
    b[12] = a[12];
    b[13] = a[13];
    b[14] = a[14];
    b[15] = a[15];
    return b;
    }

Test runner

Ready to run.

Testing in
TestOps/sec
new float32array
var b = new Float32Array(a);
ready
copy manual
var b = a.copy();

 
ready
copy fn
var b = copy(a);
ready

Revisions

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