mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
new benchmarks
This commit is contained in:
parent
2ab579f550
commit
cad95a1bfa
13
benchmark/ledstring_1.js
Normal file
13
benchmark/ledstring_1.js
Normal 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
12
benchmark/ledstring_2.js
Normal 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
13
benchmark/ledstring_3.js
Normal 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
13
benchmark/ledstring_4.js
Normal 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();
|
||||
Loading…
x
Reference in New Issue
Block a user