new benchmarks

This commit is contained in:
Gordon Williams 2014-01-31 10:20:55 +00:00
parent 2ab579f550
commit cad95a1bfa
4 changed files with 51 additions and 0 deletions

13
benchmark/ledstring_1.js Normal file
View File

@ -0,0 +1,13 @@
var rgb = new Uint8Array(25*3);
var pos=0;
function getPattern() {
pos++;
for (var i=0;i<rgb.length;i+=3) {
rgb[i ] = (1 + Math.sin((i+pos)*0.1324)) * 127;
rgb[i+1] = (1 + Math.sin((i+pos)*0.1654)) * 127;
rgb[i+2] = (1 + Math.sin((i+pos)*0.1)) * 127;
}
}
for (var i=0;i<100;i++) getPattern();

12
benchmark/ledstring_2.js Normal file
View File

@ -0,0 +1,12 @@
var pos=0;
function getPattern() {
var rgb = "";
pos++;
for (var i=0;i<75;i+=3) {
rgb += String.fromCharCode((1 + Math.sin((i+pos)*0.1324)) * 127) +
String.fromCharCode((1 + Math.sin((i+pos)*0.1654)) * 127) +
String.fromCharCode((1 + Math.sin((i+pos)*0.1)) * 127);
}
}
for (var i=0;i<100;i++) getPattern();

13
benchmark/ledstring_3.js Normal file
View File

@ -0,0 +1,13 @@
var rgb = new Array(25*3);
var pos=0;
function getPattern() {
pos++;
for (var i=0;i<rgb.length;i+=3) {
rgb[i ] = (1 + Math.sin((i+pos)*0.1324)) * 127;
rgb[i+1] = (1 + Math.sin((i+pos)*0.1654)) * 127;
rgb[i+2] = (1 + Math.sin((i+pos)*0.1)) * 127;
}
}
for (var i=0;i<100;i++) getPattern();

13
benchmark/ledstring_4.js Normal file
View File

@ -0,0 +1,13 @@
var rgb = new Uint8Array(25*3);
var pos=0;
function getPattern() {
pos++;
for (var i=0;i<rgb.length;) {
rgb[i++] = (1 + Math.sin((i+pos)*0.1324)) * 127;
rgb[i++] = (1 + Math.sin((i+pos)*0.1654)) * 127;
rgb[i++] = (1 + Math.sin((i+pos)*0.1)) * 127;
}
}
for (var i=0;i<100;i++) getPattern();