You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Hi - yes, it's an issue with JavaScript's handling of arrays. Since arrays can hold absolutely anything, by default they're not very memory efficient.

    However if you tell Espruino what you want to put in them then you can do much better. Try:

    var cmd={
    On:    new Float32Array([8.97,4.42 ... ]),
    Down:  new Float32Array([8.97,4.42 ...])
    etc
    

    and you should be fine (it'll be around 8 times more efficient!). You can compact them down even more (for instance storing them in an array of bytes), but then you have to worry about scaling.

    There's a bit more information about memory efficiency here: http://www.espruino.com/Performance

About

Avatar for Gordon @Gordon started