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

    There are a whole bunch of fixes but the main improvements are:

    JsVar size has dropped from 20 to 16 bytes on most boards

    This means that instead of 1800 vars, you now have 2250 available on the Espruino Board.

    Array or Object elements that are smallish integers are stored in one variable

    On the Espruino board, this means -32768 to 32767. So now, you've got more variables available and for some structures you also use half as many!

    Added E.getSizeOf(...)

    If you were (or are still) having troubles with memory, you can now use E.getSizeOf(...) to check out how many of your 2250 variables your structure is using up. It should give you a good idea where you should be focussing your efforts.

    For instance the following will list all global variables along with how big they (and all variables referenced from them) are:

    for (var i in this) print(i,E.getSizeOf(this[i]))

    So overall, if you were having problems with a lack of memory, hopefully you won't any more.

    It's a pretty big change, but I (and a few other forum members) have been testing this for a few weeks now. Let us know on the forum if you hit any problems though.

    If you're interested in what this actually means in terms of implementation, check out the Performance and Interpreter Internals pages.


Avatar for Gordon @Gordon started