Highlights the fact that Espruino interpreter lives of the source... the shorter the source, the faster the execution (even if it just spaces that have to be skipped) - and resolving variable names is obviously a heavy hit... and even heavier when global. Therefore, a comparison of a variable against undefined versus a local, short-named variable of value undefined is expected to be faster, is it? Wondered also about the this in the object-oriented use of javascript: does it qualify for 'short variable'?
Interesting question: What executes faster ?
a) if with large then and else block
b) two function/method definitions and and an if invoking either one of those two functions.
Since the code is in the RAM, some minimal JIT could be done... may be there is already something done...
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.
Highlights the fact that Espruino interpreter lives of the source... the shorter the source, the faster the execution (even if it just spaces that have to be skipped) - and resolving variable names is obviously a heavy hit... and even heavier when global. Therefore, a comparison of a variable against undefined versus a local, short-named variable of value undefined is expected to be faster, is it? Wondered also about the this in the object-oriented use of javascript: does it qualify for 'short variable'?
Interesting question: What executes faster ?
Since the code is in the RAM, some minimal JIT could be done... may be there is already something done...