• Hi! I've been putting a bunch of work into optimisations on Espruino/Bangle.js lately, and I've done a bunch of stuff with the latest builds.

    You'll find that writes to 1/2/4 bit offscreen buffers are a lot faster now, built-in JS functions now execute a lot faster (we're able to skip a 'parsing' step, and we also store them pretokenised), and for Bangle.js 2 specifically I've now built in the Layout library (you'll have to reinstall any apps that use Layout for the app loader to realise your Bangle has layout and upload your apps without their own version).

    Not that the change is massive, but with a totally 'factory reset' watch with android installed the load times are as follows:

    Bangle.js 2v24

    • Anton clock 246ms
    • load("messagegui.app.js") 329ms with read message
    • load("messagegui.app.js") 331ms with unread message

    2v24.128

    • Anton clock 241ms
    • load("messagegui.app.js") 271ms with read message
    • load("messagegui.app.js") 308ms with unread message

    So we manage to be 10% faster when viewing messages, and any app that uses setUI/showMenu/Layout/etc should be a lot snappier.

  • 10 % improvement is nice indeed!

  • Recent tweaks I just committed to BangleApps (dev app loader):

    • Anton clock 160ms
    • load("messagegui.app.js") 210ms with read message
    • load("messagegui.app.js") 260ms with unread message

    So we're now over 80ms faster loading the bare clock, 60ms loading messages!

    I've also made some big improvements to the widget/clockinfo loading speed and fixed a few that were taking a long time to load (android/widmessages/sched) so especially if you have a lot of widgets or clockinfos you should see some noticeable improvements!

  • Just a note that you can do:

    require("Storage").writeJSON("setting.json", Object.assign(require("Storage").readJSON("setting.json",1),{bootDebug:1}))
    load();
    

    In the IDE, and then when you next load an app Bangle.js will print out how long each bit of bootcode/widget/clockinfo took to load, eg:

    .boot0 122 ms
    android.boot.js 31 ms
    bthome.boot.js 28 ms
    health.boot.js 10 ms
    messagegui.boot.js 1 ms
    sched.boot.js 10 ms
    welcome.boot.js 2 ms
    widlock.wid.js 2 ms
    widbat.wid.js 5 ms
    widbt.wid.js 3 ms
    widid.wid.js 3 ms
    widalarm.wid.js 6 ms
    widmessages.wid.js 39 ms
    recorder.wid.js 30 ms
    recorder.clkinfo.js 8 ms
    clkinfogpsspeed.clkinfo.js 6 ms
    clkinfocal.clkinfo.js 10 ms
    bthome.clkinfo.js 11 ms
    clkinfosec.clkinfo.js 7 ms
    stopw.clkinfo.js 12 ms
    smpltmr.clkinfo.js 32 ms
    sched.clkinfo.js 38 ms
    

    You can turn it off with:

    require("Storage").writeJSON("setting.json", Object.assign(require("Storage").readJSON("setting.json",1),{bootDebug:0}))
    

    So you can then see pretty clearly which things are slowing down the boot time of your Bangle. The app itself isn't included in that list though.

  • That's cool - I'll do that on my watch!

  • Thanks for your continued work Gordon, it's much appreciated! I'll try it out once I get back from vacation.

    Did I understand correctly that I need to reinstall all apps for them to be re-pretokenized?

  • Thanks!

    Did I understand correctly that I need to reinstall all apps for them to be re-pretokenized?

    If you've installed everything in the last 6 months with the pretokenised option enabled and up to date firmware then there's no need.

    But it shouldn't hurt to click 'Reinstall apps' (which should keep existing apps' data but will re-upload everything else). It doesn't hurt to do a backup first just in case though!

    I just added a bit of info on what I mentioned above in https://www.espruino.com/Bangle.js+Performance - so if your Bangle is running slow then that might help you to figure out what apps are causing it!

  • I tried it out and it actually feels faster than before, even without measuring. I guess we're just very close to jacob nielsons 100ms target (which is for web applications but remains a valid goal for UI development)[1]. That's also why a 10 or 20% improvement feels much more impactful than just linearly "10% faster"

    @Gordon any chance you could provide "noflash" build with these optimizations? I'm wondering if running on the internal flash could do the last bit for responsiveness.

    1: https://www.nngroup.com/articles/response-times-3-important-limits/

  • Just attached - I posted one in another thread recently but there's an issue with compaction which I haven't been able to track down, so it's not really that stable


    1 Attachment

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

Bangle.js cutting edge (2v24.131 and later) speed improvements

Posted by Avatar for Gordon @Gordon

Actions