You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • This one?

    It may be slightly out of date as we've tweaked the amount of available vars recently.

    JS typically executes in RAM, so I assume the full size of the JS text is subtracted from available RAM before the rest is allocated to variables?

    Espruino will execute JS direct from flash (as long as you save using the IDE and not the save() function - see so the actual RAM usage of a function is just what's needed for the declaration (~3 vars + 1 per argument).

    What determines whether a JS variable uses 12 or 16 bytes?

    It's the total number of variables the board supports. It's basically address size.

    Now, the situation is a bit more complex as some boards use 13/14/15 bytes for variables as they're able to pack the addresses a little more tightly.

    What options are there for "maximizing" flash or RAM space? I believe it's possible to execute code from flash, but with a possible performance penalty. Where can I find more information on that?

    There's no huge performance penalty for executing from Flash on most boards. There is a bit on Bangle.js because the flash chip is external, but on everything else flash is tightly coupled to the chip so isn't noticeably slower than RAM.

    These should help:Ā­-suggestions (to a lesser extent)


Avatar for Gordon @Gordon started