I hope we can raise this upload speed limit I am reaching. @Gordon, it looks like the chunk size you mention 256 bytes every 200ms, that's where my ~1kb per second comes from. @ClearMemory041063, I tried your code, but it runs after 2 steps in a "Execution Interrupted New interpreter error: LOW_MEMORY,MEMORY".
There is another strange thing, drain get called one more times after res.end() has been called.
Here's the code that looks into the dSnd, 12.5sec for 15ko :
var n = 5, chk=3*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();
res.on('drain',function() {
print("n=", n,"t:",(getTime()-t).toFixed(3),"sec");
if (n===0){
res.end();
clearInterval(inter);
print("end n=",n,"t:",(getTime()-t).toFixed(3),"sec");
} else {
res.write(E.toString(tdata));
n--;
}
//end else
});//end opr
inter=setInterval(function () {
console.log("--t:",(getTime()-t).toFixed(3),"res",res.dSnd.length);
}, 100);
}//end function
require('http').createServer(onPageRequest).listen(80);
_____ _
| __|___ ___ ___ _ _|_|___ ___
| __|_ -| . | _| | | | | . |
|_____|___| _|_| |___|_|_|_|___|
|_| 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
n= 5 t: 0.004 sec
--t: 0.103 res 3072
--t: 0.203 res 3072
--t: 0.303 res 2804
--t: 0.403 res 2804
--t: 0.503 res 2536
--t: 0.603 res 2536
--t: 0.703 res 2268
--t: 0.803 res 2268
--t: 0.903 res 2000
--t: 1.003 res 2000
--t: 1.103 res 1732
--t: 1.203 res 1732
--t: 1.303 res 1732
--t: 1.403 res 1464
--t: 1.503 res 1464
--t: 1.603 res 1196
--t: 1.703 res 1196
--t: 1.803 res 928
--t: 1.903 res 928
--t: 2.003 res 660
--t: 2.103 res 660
--t: 2.203 res 392
--t: 2.303 res 392
--t: 2.403 res 124
--t: 2.503 res 124
n= 4 t: 2.589 sec
--t: 2.603 res 3072
--t: 2.703 res 3072
--t: 2.803 res 3072
--t: 2.903 res 2804
--t: 3.003 res 2804
--t: 3.103 res 2536
--t: 3.203 res 2536
--t: 3.303 res 2268
--t: 3.403 res 2268
--t: 3.503 res 2000
--t: 3.603 res 2000
--t: 3.703 res 1732
--t: 3.803 res 1732
--t: 3.903 res 1464
--t: 4.003 res 1464
--t: 4.103 res 1196
--t: 4.203 res 1196
--t: 4.303 res 928
--t: 4.403 res 928
--t: 4.503 res 660
--t: 4.603 res 660
--t: 4.703 res 660
--t: 4.803 res 392
--t: 4.903 res 392
--t: 5.003 res 124
--t: 5.103 res 124
n= 3 t: 5.118 sec
--t: 5.203 res 3072
--t: 5.303 res 3072
--t: 5.403 res 2804
--t: 5.503 res 2804
--t: 5.603 res 2536
--t: 5.703 res 2536
--t: 5.803 res 2268
--t: 5.903 res 2268
--t: 6.003 res 2000
--t: 6.103 res 2000
--t: 6.203 res 1732
--t: 6.303 res 1732
--t: 6.403 res 1464
--t: 6.503 res 1464
--t: 6.603 res 1196
--t: 6.703 res 1196
--t: 6.803 res 928
--t: 6.903 res 928
--t: 7.003 res 660
--t: 7.103 res 660
--t: 7.203 res 660
--t: 7.303 res 392
--t: 7.403 res 392
--t: 7.503 res 124
--t: 7.602 res 124
n= 2 t: 7.619 sec
--t: 7.703 res 3072
--t: 7.803 res 3072
--t: 7.903 res 2804
--t: 8.003 res 2804
--t: 8.103 res 2536
--t: 8.203 res 2536
--t: 8.303 res 2268
--t: 8.403 res 2268
--t: 8.503 res 2000
--t: 8.603 res 2000
--t: 8.703 res 2000
--t: 8.803 res 1732
--t: 8.903 res 1732
--t: 9.003 res 1464
--t: 9.103 res 1464
--t: 9.203 res 1196
--t: 9.303 res 1196
--t: 9.403 res 928
--t: 9.503 res 928
--t: 9.603 res 660
--t: 9.703 res 660
--t: 9.803 res 392
--t: 9.903 res 392
--t: 10.003 res 124
--t: 10.103 res 124
n= 1 t: 10.176 sec
--t: 10.203 res 3072
--t: 10.303 res 3072
--t: 10.403 res 2804
--t: 10.503 res 2804
--t: 10.603 res 2804
--t: 10.703 res 2536
--t: 10.803 res 2536
--t: 10.903 res 2268
--t: 11.003 res 2268
--t: 11.103 res 2000
--t: 11.203 res 2000
--t: 11.303 res 1732
--t: 11.403 res 1732
--t: 11.503 res 1464
--t: 11.603 res 1464
--t: 11.703 res 1464
--t: 11.803 res 1196
--t: 11.903 res 1196
--t: 12.003 res 928
--t: 12.103 res 928
--t: 12.203 res 660
--t: 12.303 res 660
--t: 12.403 res 392
--t: 12.503 res 392
--t: 12.603 res 124
--t: 12.703 res 124
n= 0 t: 12.767 sec
end n= 0 t: 12.769 sec
n= 0 t: 0.004 sec
end n= 0 t: 0.006 sec
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.
I hope we can raise this upload speed limit I am reaching.
@Gordon, it looks like the chunk size you mention 256 bytes every 200ms, that's where my ~1kb per second comes from.
@ClearMemory041063, I tried your code, but it runs after 2 steps in a "Execution Interrupted New interpreter error: LOW_MEMORY,MEMORY".
There is another strange thing, drain get called one more times after res.end() has been called.
Here's the code that looks into the dSnd, 12.5sec for 15ko :