You are reading a single comment by @fanoush and its replies.
Click here to read the full conversation.
-
What you're doing there with the getShoeImageSource function looks good to me.
Well, just measured and calling the
getShoeImageSource
takes 15ms>var d=Date();getShoeImageSource();d=Date().ms-d.ms; =15.47241210937 >var d=Date();getShoeImageSource();d=Date().ms-d.ms; =15.65551757812
writing to file and then drawing it from file vs from
getShoeImageSource
var s=require("Storage") s.write("yyshoeimage",getShoeImageSource()) >var d=Date();g.drawImage(s.read("yyshoeimage"),20,20);d=Date().ms-d.ms; =12.05444335937 >var d=Date();g.drawImage(getShoeImageSource(),20,20);d=Date().ms-d.ms; =26.51977539062
whether 15ms of CPU time is worth optimizing (for power, when e.g. redrawing watchface periodically) is of course debatable, if drawn every second it can make a difference.
What you're doing there with the getShoeImageSource function looks good to me.
In terms of the different rendering, could it be that the default 'theme' is different on Bangle.js 1 and 2? 1 uses white on black, 2 uses black on white, but they are configurable.
The layout library is a tricky one - it does use a lot more memory/time than just manually specifying sizes, but then it is a lot more flexible. I'd love to get the memory usage down, but it's hard as it does have to store the layout information for each UI element.