Thank you for pointing this out. I don't usually read big chunks, so I never wondered about this. I committed this to the repository for people who may find it useful.
It seems that function calls are very inefficient (otherwise this wouldn't be much faster than calling the read function in a loop). Do you know any way in Espruino's JavaScript to make it an inline call like it's possible in C?
Another idea I had was changing the read method like this:
Flash.prototype.read = this.spi.send;
i.e. making the read property point directly to the property of the spi class. This seems a bit unclean but it may work and actually be faster. I don't have that chip right now, but maybe you can test.
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.
Thank you for pointing this out. I don't usually read big chunks, so I never wondered about this. I committed this to the repository for people who may find it useful.
It seems that function calls are very inefficient (otherwise this wouldn't be much faster than calling the read function in a loop). Do you know any way in Espruino's JavaScript to make it an inline call like it's possible in C?
Another idea I had was changing the read method like this:
i.e. making the read property point directly to the property of the spi class. This seems a bit unclean but it may work and actually be faster. I don't have that chip right now, but maybe you can test.