You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • The latest builds of Espruino have some big code size and speed improvements...

    • Functions don't store { and } - this can mess up your code formatting a little if you call dump() and you don't use the 2 character indents that are generally used in Espruino code, but it's worth it - a lot of RAM gets saved
    • Simple Functions of the form function (...) { return ... } don't have return stored internally. This saves a bunch of space and improves execution speed.
    • Small strings (<=10 chars on Espruino boards) can now be fitted into one variable. Anything over 4 got put into 2 variables before.

    So... execution speed has increased:

    function sum(a,b) { return a+b; }
    
    function test() {
      var arr = new Uint8Array(10000);
      var t = getTime();
      var res = arr.reduce(sum);
      console.log(getTime()-t);
    }
    
    // 1v81
    >test()
    1.40450859069
    
    // current build
    >test()
    1.18919467926
    

    And, memory usage has reduced a lot, at least in some cases:

    var a = {
      a : function() { return alice; },
      b : function() { return bob; },
      c : function() { return carrie; },
      d : function() { return dave; },
      e : function() { return elise; },
    };
    
    // 1v81
    >E.getSizeOf(a)
    =29
    
    // current build
    >E.getSizeOf(a)
    =21
    

    It should really shine when using minified code (for instance all of Espruino's modules).

    But these are some big changes - while I do test here, it'd be great if some of you could give the latest images a try and see if you encounter any problems.

    As usual, you just go here and find a build for your board (Pico or Original Espruino boards only, and you probably want the WIZnet one). Then, right-click and copy the URL of the .bin file, open up the Web IDE, go to flashing, and paste it into the URL under Advanced Firmware Update and click the button next door to it.

About

Avatar for Gordon @Gordon started