Hopefully it's not a big deal to fix the eval... However can you not just define functions rather than strings? You can call them with fn.call(this), and maybe even some arguments...
bind() implementation, what is the memory footprint compared to creating an anonymous function instead?
It's not too bad. One memory unit for the function itself, one per parameter, plus one for this, one for code, and maybe others if the function was defined inside another function - but everything else is shared (including the code itself).
It's going to be a bit better than an anonymous function - check it out with trace() :)
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.
Hopefully it's not a big deal to fix the eval... However can you not just define functions rather than strings? You can call them with
fn.call(this)
, and maybe even some arguments...It's not too bad. One memory unit for the function itself, one per parameter, plus one for
this
, one for code, and maybe others if the function was defined inside another function - but everything else is shared (including the code itself).It's going to be a bit better than an anonymous function - check it out with
trace()
:)