I am in the first case: Esp8266 with Espruino flashed into the Esp8266. By marshalling data, I assume you refer to the E.toString. It's not much different without marshalling. The loop finish in only 13ms with a straight string (instead of 26ms for uint8array), but the 5kb of data still make 5 seconds to finish loading in the browser, in at least ten pieces :
var data="";
var chk=1024;
for(var i=0;i<chk;i++) data+="0";
function onPageRequest(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
var n= 5, t=getTime();
for(var i=0;i<n;i++) {
res.write(data,'binary');
print("t:",(getTime()-t).toFixed(3),"sec");
}
res.end();
}
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.002 sec
t: 0.005 sec
t: 0.008 sec
t: 0.010 sec
t: 0.013 sec
t: 0.002 sec
t: 0.005 sec
t: 0.008 sec
t: 0.010 sec
t: 0.013 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 am in the first case: Esp8266 with Espruino flashed into the Esp8266. By marshalling data, I assume you refer to the E.toString. It's not much different without marshalling. The loop finish in only 13ms with a straight string (instead of 26ms for uint8array), but the 5kb of data still make 5 seconds to finish loading in the browser, in at least ten pieces :