-
which device are you using? your code still crashes for me even without Neopixel-specific calls (which you may - and perhaps should - leave enabled as they do not expect any feedback but, effectively, just send pulses to pin B15)
Amendment: moving outer variables into the three main functions (as you suggested) also already hangs up my code.
Personally, I'd recommend to "diff" the code generated for the working and the non-working versions of my source for the original Espruino and look at the changes as s.th. really weird must be going on...
for me it does not crash, however I am turning neopixel off as I don't have it. with your code I started with
and ended with
cachin globals to local variables give speedup and also the native code produced is smaller,
here is code , I don't know what values it computes, it does not crash and can be timed repeatedly