Bangle.js 2 speedups

Posted on
Page
of 3
/ 3
Last Next
  • Hi,

    I've been putting a lot of work into Espruino's speed recently, so if you're on (or upgrade to) a cutting edge build (2v15.90 or later) with the latest apps from the app loader hopefully you'll see some big improvements.

    • JS speed improvements - I have managed to squeeze around 15% extra performance out of the interpreter since 2v15
    • Clocks and the Launcher now 'fast switch' (if they both have widgets showing) without reloading the JS environment, which makes things a lot snappier - This is mainly @halemmerich's work
    • Clock/Launcher loading avoids searching for the correct app each time, shaving ~100ms off the start time
    • The default launcher now caches app info, which saves a lot of time if you have many apps
    • Bangle.js now continues to execute JS code while writing to the LCD, which means it can be starting to prepare the next frame while it's sending out the last one
    • Full-width rectangle fill speed in black/white is now 12x faster
    • The LCD driver has been completely turned on its head so data is stored in the opposite order and reversed as it is sent out. This makes doing graphics operations around 40% faster

    I'd be really interested to see how you find this... Specifically Clock->Launcher->Scroll->Clock interactions should be hugely improved.

    If you encounter issues, please revert back to 2v15 and check they don't exist there - but if you're sure it is something that's broken due to these changes please do let me know in this thread.

    ... I also added another new clock based on a suggestion from some time ago: https://banglejs.com/apps/?id=slopeclock


    1 Attachment

    • screenshot.png
  • Oh wow it definitely feels much faster now and I love your new slopeclock! Looks really really great and the animation is really smooth :D

    Nevertheless, I think I found one little issue -- but I'm not 100% sure if its the settings app or the firmware update: I can no more open the LCD settings -- I already tried to re-write the settings, I tried an older settings version (0.49) and I removed the setting.json file completely, but I always get the following error (read via Web IDE):

    Uncaught Error: Cannot read property 'wakeOnBTN1' of undefined
     at line 29 col 630 in setting.app.js
    ...N1':{value:settings.options.wakeOnBTN1,format:boolFormat,onc...
                                  ^
    in function "showLCDMenu" called from line 14 col 127 in setting.app.js
    showLCDMenu()
                ^
    in function "b" called from line 1 col 79
    ...if("function"==typeof b)b(l);else if("object"==typeof b)if("...
                                  ^
    in function "select" called from line 1 col 52
    c.y<a.y-4||(b=k(c.y),(0>f||0<=b)&&b<d.c&&d.select(b))
                                                       ^
    in function "p" called from line 1 col 17
    d.handled||p(a,d)
                    ^
    in function called from system
    

    Update1: I also downloaded the setting.json file if it helps as it seems that some props are missing in my settings.json file.
    Update2: If I manually upload the "settings.min.js" file from the setting github repo everything works fine again. So not sure if only my Bangle was corrupted but I found it a bit strange that rewrite settings did not help...


    1 Attachment

  • I had the same issue a while ago (missing property from settings.json), at the time I figured I just messed it up myself somehow, but maybe there's a bug somewhere?

  • It's not news I really appreciate the speedups, not having to wait for the watch is a huge quality of life improvement - thanks!

    Slope clock is very stylish! :D

  • @PeerDavid that's an odd one - it looks like something did get corrupted, but I'm not sure how... but the settings app should be able to cope with a corrupted file anyway. I'll take a look and get a change in (it looks like it'll be as easy as checking if options is an object or not).

    ... but I'd love to know why it got messed up in the first place.

  • Just got my Bangle and am absolutely loving it. Updates like this are just the cherry on top.

  • Thanks! That's great to hear!

    @PeerDavid I just updated settings to stop this happening in future, but if you ever get an idea what might have been breaking the settings.json in the first place I'd love to hear it (could qmsched have had an effect?)

  • Thanks a lot!
    And sure, if it happens again or if I'm able to reproduce it I will let you know :)

    qmsched is not installed on my Bangle -- this is the list of apps that I have on my Bangle in case it helps:

    health, widlock, linuxclock, lcars, agpsdata, swp2clk, ptlaunch, bwclk, weather, hrm, ha, sched, smpltmr, info, agenda, widminbt, widbata, widChargingStatus, pebble, android, neonx, 93dub, scicalc, spotrem, kbmulti, messages, aiclock, antonclk, widmsggrid, boot, slopeclock, launch, setting, widpa
    
  • Nice!

    I just noticed an issue with Swiper Clock Launch: I can navigate from Clock to Launcher but Launcher to Clock does not work anymore. I already did a settings rewrite. No errors in the console.


    btw slope clock is really cool!

  • @Alessandro I just updated 'Swiper Clock Launch' so it should fix this.

  • @Gordon, excellent work! I love seeing the changes coming to the Bangle!

  • @Gordon - nice one. Blisteringly fast. Nice to see the original Anton Clock back as well.

  • I had an idea last night, and now graphics fills in 2v15.93 are around 6x faster than in 2v15 (4x faster than 2v15.90).

    So even if you updated to 2v15.90, updating again is probably worth it - hopefully it'll make a really big difference to the way the watch feels. I'll try and get a 2v16 release out next week so the improvements can roll out to more people.

  • Is the fast switch something that needs to be implemented into the launcher?
    I am using 'Desktop Launcher' and don't notice any big difference.

  • Yes, the launcher currently needs to load the clock app using setTimeout(eval,0,s.read(".bootcde")); and additionally it needs to undo all changes with a global impact other than Bangle.loadWidgets() to prevent memory/resource leaks. The default launcher for example does the cleanup in lines 48-50 in the returnToClock-method.

    The clock needs to use Bangle.setUI and give it an options object containing a remove method to clean up everything it changed in the global scope.

    If clock and launcher are implemented this way, fast switching between those works. If only one of launcher and clock use this way fast switching only works while leaving that app.

  • I did some work on getting remove-functionality into dtlaunch here. It worked ok, but when using it with a modified bwclock I had a ram leak somewhere. Not sure if that was dtlaunch or bwclock though - or both. If you want you're of course free to use this as a starting point for bringing fast loading to the 'official' dtlaunch, @Hank! :) I think there have been some developments since I worked on it, some (or maybe all :P ) of which @halemmerich mention above.

  • Glitch - special to Circles Clock or hint to general problem?
    Wanted to try out cutting edge 2.15.93. Got also 6 app updates (including launcher and circles clock now 0.16). So don't know really whether firmware or app is to blame.
    Now if going back from launcher via button only the left circle is visible, rest of clock face is missing. Going back with tap on upper left arrow works fine.
    This is reproducible here, also after a reboot.

    @Gordon Not a big deal for me. Wanted to let you know in case this is symptom of some general problem before it goes into a stable 2.16

    [Update]: Hmm, now bootloader was updated (was not shown before?)
    Now effect seems gone.

  • 93 seems to have broken some of the lcd settings.
    Wake on twist is disabled but still happens.
    It would be okay if I was single, but she likes an indisturbed sleep and this may become a terrible strain on marital harmony.

  • After toggling Wake on twist, try forcing 'rewrite settings' under utils in the settings. If that works at least it's a temporary fix :)

    (I just tried and had the opposite problem of yours before forcing the rewrite of settings)

  • Thanks, that worked. You may have saved my marriage.
    When it comes to a choice between family and gadgets.
    I don't know where the hammer would fall.
    It's a decision that is best not tested.

  • Now if going back from launcher via button only the left circle is visible, rest of clock face is missing.

    I think I introduced an issue in launcher 0.18 - 0.19 should have this fixed (i'll update the official app loader with it in an hour or so)

  • Not sure if it's worth it, but the app loader tried minifying all code a while ago. Back then it broke apps, because Espruino didn't support let/const scopes, so variable mangling ended up with duplicates.
    But now that scopes are properly supported, maybe it could be turned back on?
    I know the code is already pretokenized, but at least variable mangling might speed things up a bit? (and maybe the minifier knows some other tricks)

  • Interesting - I'd forgotten about that and assumed that we minified! Maybe it could be another option in the App Loader for now so that it can be turned on for those that are interested?

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

Bangle.js 2 speedups

Posted by Avatar for Gordon @Gordon

Actions