• @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);
    
     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| 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
    n= 4 t: 4.339 sec
    n= 3 t: 7.640 sec
    n= 2 t: 10.941 sec
    n= 1 t: 14.263 sec
    n= 0 t: 17.558 sec
    n= 0 t: 17.559 sec
    
    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);
    
     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| 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.003 sec
    n= 4 t: 3.330 sec
    n= 3 t: 6.626 sec
    n= 2 t: 9.945 sec
    n= 1 t: 13.246 sec
    n= 0 t: 16.599 sec
    n= 0 t: 16.601 sec
    
About

Avatar for Polypod @Polypod started