during some testing, I tried to compare speed of 2 solutions.
It figured out, this is not possible. As you can see in listing below, even for simple loop result is not reliable.
To avoid misunderstanding, I'm pretty sure reason is not Espruino or emulator.
Would see reason being located in browser and/or OS
var d = new Date(); for(var i = 0; i < 1000;i++){var b = 1 + 3;} console.log(new Date() - d);
17
=undefined
>var d = new Date(); for(var i = 0; i < 1000;i++){var b = 1 + 3;} console.log(new Date() - d);
15
=undefined
>var d = new Date(); for(var i = 0; i < 1000;i++){var b = 1 + 3;} console.log(new Date() - d);
26
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
during some testing, I tried to compare speed of 2 solutions.
It figured out, this is not possible. As you can see in listing below, even for simple loop result is not reliable.
To avoid misunderstanding, I'm pretty sure reason is not Espruino or emulator.
Would see reason being located in browser and/or OS