In custom.html, merge all of imageclock.draw.js into imageclock.app.js - and then it'll all get minified together and should end up faster.
I tried this and got 5-10% faster time to first complete draw by pretokenization alone. Additionally using minification got about 5% on top of that. So pretty worthwhile I think.
for (let a of a.getPoints())
It looks like a minifier bug? a = [3,4,5]; for (let a of a) console.log(a); fails in Node.js too so it's not a problem with Espruino not being spec compliant.
That could well be. I could not find similar problem descriptions, but redeclaring a variable existing in an outside scope sure seems fishy.
Edit: I have tried running the closure compiler on the same code and it creates for (var n of a.getPoints()) instead
the minifier generated a constant named g into a block of code calling Bangle.load which in turn calls g.reset()
That feels like another minifier bug?
I don't know. Does the minifier actually know that Bangle.load can call g.whatever()? This is probably a quite seldom problem, since you need to have code using enough variables that the minifier gets to "g" as a variable name. Maybe it would be enough to prohibit the minifier from using "g" as a name?
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.
Continuation of: original post
I tried this and got 5-10% faster time to first complete draw by pretokenization alone. Additionally using minification got about 5% on top of that. So pretty worthwhile I think.
That could well be. I could not find similar problem descriptions, but redeclaring a variable existing in an outside scope sure seems fishy.
Edit: I have tried running the closure compiler on the same code and it creates
for (var n of a.getPoints())
insteadI don't know. Does the minifier actually know that
Bangle.load
can callg.whatever()
? This is probably a quite seldom problem, since you need to have code using enough variables that the minifier gets to "g" as a variable name. Maybe it would be enough to prohibit the minifier from using "g" as a name?