For the twinkle, can you just use a table of intensities that you cycle through over time? Maybe just multiply 'mult' by the value that's in it?
I'm not quite sure what the twinkle effect is (I haven't tried the code) but if it could be replaced by a table, it'd probably speed things up a lot.
@Gordon started
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.
For the twinkle, can you just use a table of intensities that you cycle through over time? Maybe just multiply 'mult' by the value that's in it?
I'm not quite sure what the twinkle effect is (I haven't tried the code) but if it could be replaced by a table, it'd probably speed things up a lot.