Accurate Periodic Timer

@kiwitech
Have you considered outputting a PWM signal from one pin into a pin that generates a change of state interrupt? I imagine that the PWM output is divided down from the oscillator and will be quite reliable.

Also, your stats are really helpful. Although, I’m not sure that I agree with all of them.

Squirrel seems to pre-allocate table slots and array spaces in chunks to mitigate constantly having to resize. This may have a bearing on performance of newslot and push/append.

If you want fast array operations, it absolutely makes sense to pre-allocate and just maintain an integer pointer to where you’re writing.

I was surprised by your switch lookup figures. If this is right, does this mean that cases in a switch statement are tested from bottom to top?

I use try/catch in lieu of if (“x” in y) quite a bit and try/catch is definitely faster if you expect to find the key. I agree that try/catch takes longer if the key is not present.