Is it possible to flush this buffer to be sent immediately somehow ? or get called until the buffer is really full ?
As if it is making an unnecessary break before each send. If I reduce the chunk size from 5kb to 256bytes, the average speed is dramatically decreased.
I can't send 20kb in one go, I get "New interpreter error: LOW_MEMORY,MEMORY". If I send only 1 chunk of 5bk, it still takes 5 seconds even straight away without ondrain:
function onPageRequest(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
var n = 1, chk=5*1024, t=getTime();
res.write(E.toString(new Uint8Array(chk)));
res.end();
}
require('http').createServer(onPageRequest).listen(8080);
It actually seems hanging few seconds before sending anything.
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.
Is it possible to flush this buffer to be sent immediately somehow ? or get called until the buffer is really full ?
As if it is making an unnecessary break before each send. If I reduce the chunk size from 5kb to 256bytes, the average speed is dramatically decreased.
I can't send 20kb in one go, I get "New interpreter error: LOW_MEMORY,MEMORY". If I send only 1 chunk of 5bk, it still takes 5 seconds even straight away without ondrain:
It actually seems hanging few seconds before sending anything.