@ClearMemory041063, I am surprised it goes a bit faster on your setup. I still got 17 sec for the 20kb, when I tried the two programs you posted. I tried with/out AP/station, no change. What version of espruino are you running ?
The only change I did was 5*4kb chunk, instead of 4*5kb chunks, as the latter stopped after n=3 (I guess a memory shortage).
var n = 5, chk=4*1024;
var tdata=new Uint8Array(chk);
var i;
for(i=0;i<1024;i++){
tdata[i]=0x30;
tdata[i+1024]=0x31;
tdata[i+1024*2]=0x32;
tdata[i+1024*3]=0x33;
// tdata[i+1024*4]=0x34;
}//next i
function onPageRequest(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
var t=getTime();
n=5;
res.on('drain',function() {
print("n=",n,"t:",(getTime()-t).toFixed(3),"sec");
if (n===0){
res.end();
print("n=",n,"t:",(getTime()-t).toFixed(3),"sec");
}else {
res.write(E.toString(tdata));
n--;
}//end else
});//end opr
}//end function
require('http').createServer(onPageRequest).listen(80);
var n = 5, chk=4*1024;
var tdata=new Uint8Array(chk);
function onPageRequest(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
var t=getTime();
res.on('drain',function() {
print("n=",n,"t:",(getTime()-t).toFixed(3),"sec");
if (n===0){ res.end();
print("n=",n,"t:",(getTime()-t).toFixed(3),"sec");
}else {
res.write(E.toString(tdata));
n--;
}//end else
});//end opr
}//end function
require('http').createServer(onPageRequest).listen(80);
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.
@ClearMemory041063, I am surprised it goes a bit faster on your setup. I still got 17 sec for the 20kb, when I tried the two programs you posted. I tried with/out AP/station, no change. What version of espruino are you running ?
The only change I did was 5*4kb chunk, instead of 4*5kb chunks, as the latter stopped after n=3 (I guess a memory shortage).