Great! A definite improvement anyway. I'm not sure how far you've gone (including drawScale as I suggested or going even further to just including g.drawXYZ calls) but definitely the further you can go the better.
Yep, I'd say what @andrewg_oz says above for speed.
Maybe you could do a check on items once at startup (if you feel you need it) then skip the check each time your render. If there's an issue you'll still get an exception, it just won't be as verbose. I've not benchmarked but I would guess that:
items.forEach(c=>dofns[c.name](c.param))
Might be marginally faster.
Maybe drawing parts of the clock (digital time, weather, status icons) into arraybuffers in an event driven way and only compositing those together on every draw could be faster?
Yes, that's a tricky one. If you knew the outline you could use g.setClipRect to restrict drawing just to the clock area and then refresh just that bit.
IMO you might be able to find quite a lot of speed just by modifying how things get compiled down though (eg if you know it's a binary uncompressed image you can just draw that and skip all the checks)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Great! A definite improvement anyway. I'm not sure how far you've gone (including
drawScale
as I suggested or going even further to just includingg.drawXYZ
calls) but definitely the further you can go the better.Yep, I'd say what @andrewg_oz says above for speed.
Maybe you could do a check on
items
once at startup (if you feel you need it) then skip the check each time your render. If there's an issue you'll still get an exception, it just won't be as verbose. I've not benchmarked but I would guess that:Might be marginally faster.
Yes, that's a tricky one. If you knew the outline you could use
g.setClipRect
to restrict drawing just to the clock area and then refresh just that bit.IMO you might be able to find quite a lot of speed just by modifying how things get compiled down though (eg if you know it's a binary uncompressed image you can just draw that and skip all the checks)