Open gfwilliams opened 9 years ago
Originally: https://github.com/espruino/EspruinoTools/issues/8
Currently, if I write:
function f() { "compiled"; a = 1; a = 2; a = 3; }
It does 3 symbol table lookups for a. Ideally it'd look a up once and then keep it for future use.
a
Even more of an issue for something like:
function f() { "compiled"; digitalWrite(LED1,0); digitalWrite(LED1,1); digitalWrite(LED1,0); digitalWrite(LED1,1); }
Where both digitalWrite and LED1 get looked up each time.
While potentially that causes issues with something like this:
function setA() { a=1; } function f() { "compiled"; console.log(a); setA(); console.log(a); }
The first use of a should have failed with a ReferenceError (but it doesn't in Espruino) so we're probably safe to ignore it.
Originally: https://github.com/espruino/EspruinoTools/issues/8
Currently, if I write:
It does 3 symbol table lookups for
a
. Ideally it'd looka
up once and then keep it for future use.Even more of an issue for something like:
Where both digitalWrite and LED1 get looked up each time.
While potentially that causes issues with something like this:
The first use of
a
should have failed with a ReferenceError (but it doesn't in Espruino) so we're probably safe to ignore it.