Hi all,
I am working on a webserver using espruino and the esp8266, to store sensor data in the flash, and serve it to a web browser. But the network seems very slow, e.g. about 1kb per second, depending on the size of each write, much slower than when using Arduino. In this example, it takes 15second to serve 20kb :
function onPageRequest(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
var n = 4, chk=5*1024, t=getTime();
res.on('drain',function() {
if (n==0) res.end();
else {
res.write(E.toString(new Uint8Array(chk)));
n--; }
print("t:",(getTime()-t).toFixed(3),"sec");
});
}
require('http').createServer(onPageRequest).listen(8080);
_____ _
| __|___ ___ ___ _ _|_|___ ___
| __|_ -| . | _| | | | | . |
|_____|___| _|_| |___|_|_|_|___|
|_| http://espruino.com
1v95.23 Copyright 2017 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
Flash map 4MB:512/512, manuf 0xef chip 0x4016
>
=undefined
t: 0.021 sec
t: 5.057 sec
t: 9.288 sec
t: 13.494 sec
t: 17.717 sec
>
I tried with Arduino, it was 100x faster, and served 1.5Mb in the same 15 seconds. So it cannot be a hardware limitation. Is there a workaround or another way to send data faster with espruino ?
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.
Hi all,
I am working on a webserver using espruino and the esp8266, to store sensor data in the flash, and serve it to a web browser. But the network seems very slow, e.g. about 1kb per second, depending on the size of each write, much slower than when using Arduino. In this example, it takes 15second to serve 20kb :
I tried with Arduino, it was 100x faster, and served 1.5Mb in the same 15 seconds. So it cannot be a hardware limitation. Is there a workaround or another way to send data faster with espruino ?