In the mean time, I got computeHeating to compile as well by not directly assigning to TemperatureMap, but first to an auxiliary variable aux and then TemperatureMap[i] = aux
I tried the same trick with computeDiffusion but failed. And compiling computeHeating did not have any noticeable effect on performance - thus, I reverted my changes again.
Amendment: I tried over two dozens of variants for computeDiffusion - even silly ones like byte lookups from a Uint8ClampedArray with the values 0...255 - but all of them failed.
My current impression is that success is nothing but good luck and depends on side effects of compilation (such as overwriting memory areas because of invalid length calculations or similar)
Amendment #2: wow, indeed, success is pure luck! After all my experiments I tried to upload my working example again - and failed because I had also changed Math.random to random in the mean time. After reverting that change, the example started working again.
Which means: simply adding let random = Math.random and replacing all (four) calls of Math.random by random broke a working program!
Hopefully, this information may help Gordon et al. finding the reason for this weird compiler bug!
Technical details:
I'm using an original Espruino (Rev 1.3b) with an HC-05 attached and running Espruino 2v10
the board is connected by USB, programming is done using the Web IDE configured without minification, without mangling and without pretokenization (because I once thought, that could cause problems as well)
my Neopixel 16x16 matrix is attached to pin B15
I can send you both versions of my code - the working and the failing one
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.
In the mean time, I got
computeHeating
to compile as well by not directly assigning toTemperatureMap
, but first to an auxiliary variableaux
and thenTemperatureMap[i] = aux
I tried the same trick with
computeDiffusion
but failed. And compilingcomputeHeating
did not have any noticeable effect on performance - thus, I reverted my changes again.Amendment: I tried over two dozens of variants for
computeDiffusion
- even silly ones like byte lookups from aUint8ClampedArray
with the values 0...255 - but all of them failed.My current impression is that success is nothing but good luck and depends on side effects of compilation (such as overwriting memory areas because of invalid length calculations or similar)
Amendment #2: wow, indeed, success is pure luck! After all my experiments I tried to upload my working example again - and failed because I had also changed
Math.random
torandom
in the mean time. After reverting that change, the example started working again.Which means: simply adding
let random = Math.random
and replacing all (four) calls ofMath.random
byrandom
broke a working program!Hopefully, this information may help Gordon et al. finding the reason for this weird compiler bug!
Technical details: