• Sun 2021.04.25

    'what is the maximum length of storable/runnable javascript code in Espruino wifi?'

    Use process.memory() to determine the amount of free JsVars

    JsVars:    https://www.espruino.com/Internals

    Although it may be possible to use some fancy techinques to utilize flash in addition to available ROM, typically, Espruino needs as much memory as the code file size being uploaded, in order to unpack and reorganize in memory.

    Really rough approximation; take the number of free JsVars and divide by two to account for the need to reorganize during the upload process, then multiply by 16 bytes per JsVar.

    I don't have a WiFi handy, but if memory serves, an authentic Espruino Wifi provides around 2200 JsVars.

    2200 / 2 * 16 = 17,600 chars rough approximation

  • i just thought editor minimizing while downloading javascript code, so i can write my code beautifulized with tabulators and newlines. no needed to minimize manually to save flash memory. is it correct?

  • Mon 2021.04.26

    ref #32: 'so i can write my code beautifulized . . . no needed to minimize manually . . . is it correct?'

    I had this same question over four years ago and several provided responses to clear things up.

    Originally, I had mistaken an observation (noobie incorrect interpretation) for changes that had just occured with the new WebIDE ver ?? around Nov 2016 circa 1V88 Espruino, and was attempting to resolve.

    Just released (then) the WebIDE does a bit of housekeeping before upload along with additional cleanup once Espruino takes over. See @Gordon 's comments:

    'and also strips out whitespace and comments between commands, which would have been ignored by Espruino anyway.'


    'if something happens and data is re-arranged in memory then even that can effect the compression'


    A quick test would be to upload some heavily commented code both inside and outside functions, then upload. Use dump() to see how comments are removed. Then use process.memory() to determine the amount of free JsVars to compare with the source.

    Another useful tool: Many helpful ideas on using trace() to view actual memory contents.



Avatar for user127815 @user127815 started