Thanks - that's really interesting. Did you manage to get any real world performance stats though? It's fine in theory but I'm pretty sure the speed ends up limited by the IO bus speed.
Since JS code saved to flash is executed from flash, you should see some improvements in actual JS execution speed. I tend to use this mandelbrot code as a speed test:
function mandelbrot() {
var tm = getTime();
var sizex=32,sizey=32;
for (var y=0;y<sizey;y++) {
var line="";
for (var x=0;x<sizex;x++) {
var Xr=0;
var Xi=0;
var Cr=(4.0*x/sizex)-2.0;
var Ci=(4.0*y/sizey)-2.0;
var i=0;
while ((i<16) && ((Xr*Xr+Xi*Xi)<4)) {
var t=Xr*Xr - Xi*Xi + Cr;
Xi=2*Xr*Xi+Ci;
Xr=t;
i++;
}
line += (i&1) ? "*" : " ";
}
print(line);
}
print(getTime()-tm);
}
// from RAM
mandelbrot(); // 7.44 sec
// save to flash and then read&eval, so it'll end up in flash
require("Storage").write("mandeltest","("+mandelbrot.toString()+")");
mandelbrot = eval(require("Storage").read("mandeltest"));
// execute from flash
mandelbrot(); // 8.79 sec
If you copy & paste this in the left hand size hopefully you'll see an improvement.
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.
Thanks - that's really interesting. Did you manage to get any real world performance stats though? It's fine in theory but I'm pretty sure the speed ends up limited by the IO bus speed.
Since JS code saved to flash is executed from flash, you should see some improvements in actual JS execution speed. I tend to use this mandelbrot code as a speed test:
If you copy & paste this in the left hand size hopefully you'll see an improvement.