Espruino 2v16 released

Posted on
  • I'm pleased to announce Espruino 2v16

    This one adds some really decent performance improvements:

    Interpreter speed improvements

    After some careful analysis of the assembly, I managed to make a few tweaks to the interpreter. It's now around 12% faster, and smaller too.

    A simple 'mandelbrot' test that took 6.5s to execute on 2v15 now takes 5.8s on 2v16

    Bangle.js

    Fixes/Improvements

    • Fixed hang at boot that could be caused is Storage was corrupted in just the wrong way
    • Stopped the user breaking out of flash erase/compact commands - this should really help with corruption issues
    • Added option in settings to allow for left-handed wearers
    • Built-in touchscreen calibration in settings app
    • Compass heading now reported in the correct direction (apps changed to account for this)

    Performance

    • Massive Bangle.js 2 graphics fill improvements (6-12x faster)
    • LCD now updates 'in the background' while JS code is running
    • Flash erase can use 64k/all clear command to erase blocks much faster
    • support for Bangle.setUI({remove:...}) - Clocks/Launchers like the defaults that define this and implement it properly can now 'fast switch' to the launcher and back, which makes the experience of using a Bangle much snappier!

    JIT interpreter improved and added to MDBT42Q/Pixl.js/Puck.js/Bangle.js 1 & 2

    You can now tag functions with "jit" and they will be jit-compiled on the device. There's a relatively small subset of the language supported so it can't be used for everything, but it can really make a difference in some situations, especially if you just need to toggle some IO or munch through some data:

    var data = new Uint8Array(1000);
    for (var i=0;i<data.length;i++) data[i]=i;
    
    // Normal JS
    t=getTime();data.forEach(function (d) {
      digitalWrite(LED,d&1);
      digitalWrite(LED,d&2);
      digitalWrite(LED,d&4);
      digitalWrite(LED,d&8);
      digitalWrite(LED,d&16);
      digitalWrite(LED,d&32);
      digitalWrite(LED,d&64);
      digitalWrite(LED,d&128);
    });print(getTime()-t); // 2.83 sec 2v15,  2.61 sec 2v16
    
    // Compiled server-side with GCC
    function writeLEDs(d) {"compiled"
      digitalWrite(LED,d&1);
      digitalWrite(LED,d&2);
      digitalWrite(LED,d&4);
      digitalWrite(LED,d&8);
      digitalWrite(LED,d&16);
      digitalWrite(LED,d&32);
      digitalWrite(LED,d&64);
      digitalWrite(LED,d&128);
    }
    t=getTime();data.forEach(writeLEDs);prin­t(getTime()-t); // 1.30 sec
    
    // New, JIT
    t=getTime();data.forEach(function (d) {"jit"
      digitalWrite(LED,d&1);
      digitalWrite(LED,d&2);
      digitalWrite(LED,d&4);
      digitalWrite(LED,d&8);
      digitalWrite(LED,d&16);
      digitalWrite(LED,d&32);
      digitalWrite(LED,d&64);
      digitalWrite(LED,d&128);
    });print(getTime()-t); // 0.95 sec - > 2.5x faster!
    

    It's still early days so your mileage may vary, but it's another useful tool if you just need to output data quick or do some calculations.

    Other changes

    • Simple arrow functions like () => {...} now use one variable less than before
    • E.HSBtoRGB can now be called with E.HSBtoRGB(h,s,b,16) to return a 16 bit value suitable for Bangle.js
    • Many ESP32 Bluetooth LE central mode improvements - ESP32 can now scan and connect to other devices (for example with Nordic UART) using the exact same code/API as the offical Espruino BLE devices

    Puck.js now has a 'minimal' build with more memory dedicated to Flash storage - This strips out the more niche features (like ESP8266 Wifi support) and allows you to use the storage freed for your data - great for data logging. This was released silently in 2v14, but it deserves a mention here!

    ... and there's more! Check out http://www.espruino.com/ChangeLog for more info!

  • I should add that JIT also lets you do some really neat stuff. You can construct your own function in code, then eval it to JIT compile it to fast, native code:

    var data = new Uint8Array(1000);
    for (var i=0;i<data.length;i++) data[i]=i;
    
    var jit_me = "(function(d) { 'jit';";
    for (var i=0;i<8;i++) jit_me += `digitalWrite(LED,d&${1<<i});`
    jit_me+="})";  
    
    var jitFn = eval(jit_me);
    data.forEach(jitFn);
    
  • Thanks for all these great improvements! Looking forward to trying them out.

  • Thank you for your work! And also thanks to the community for participating :)

  • As always, there is an impressive mass of work done in order to let the Espruino users have a much better experience with every new release!

    Thank you so much Gordon (as well as the community, but everyone knows that Gordon spends 28 hours per day on making Espruino even better everyday)

    I have been using Espruino since the first kickstarter and I must say that it has changed my life as a maker, but also as an electronic engineer. Espruino has given us the opportunity to automate a lot of things, provide BLE connectivity where we would have struggled otherwise

    A huge thank you Gordon!

  • Thanks! I'm glad you're enjoying it!

    While I'm working full-time on Espruino, often I end up stuck doing a bunch of stuff that's not very visible and also not much fun for me. It's nice to have been able to spend the last few weeks doing some stuff that makes a real difference to everyone :)

  • Nice~
    Great job!
    Thanks..

  • This is amazing. I don't get nearly enough time to play with my espruino devices but I continue to be excited by it. Thanks!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Espruino 2v16 released

Posted by Avatar for Gordon @Gordon

Actions