Ok, then it didn't help and is still slow. You can verify the JIT is enabled by typing just the name of function sig and see the output.
See the difference here.
From c change it can be seen it is >thousand calls per second so the JIT is probably working and the debounce as Gordon suggested might further help.
BTW if you would remove "jit" then maybe the c would be much smaller as with "jit" it runs in about 1 milisecond (if it handles about 4000 calls in 3 seconds) which is not that bad.
EDIT: and BTW no need to put "jit" in startListening, that one is not called in tight loop and JIT eats extra RAM for generated native code. Doesn't hurt in this case, just mentioning it because overall marking everything with "jit" is not a good idea.
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.
Ok, then it didn't help and is still slow. You can verify the JIT is enabled by typing just the name of function
sig
and see the output.See the difference here.
From c change it can be seen it is >thousand calls per second so the JIT is probably working and the debounce as Gordon suggested might further help.
BTW if you would remove "jit" then maybe the
c
would be much smaller as with "jit" it runs in about 1 milisecond (if it handles about 4000 calls in 3 seconds) which is not that bad.EDIT: and BTW no need to put "jit" in startListening, that one is not called in tight loop and JIT eats extra RAM for generated native code. Doesn't hurt in this case, just mentioning it because overall marking everything with "jit" is not a good idea.