You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • DrAzzy's spot on. 2 memory units per entry and each memory unit is 20 bytes, so just by allocating an array you're using a lot of memory.

    I have an issue open (I have no idea when I'll get around to doing it) that may halve memory usage in these cases, but you'll still run out of memory quickly when working with 'normal' arrays.

    There's a bit of info here: http://www.espruino.com/Performance

    You can create a Uint8Array and then use the .set function to set its value to that of a string (it's not strictly JS compliant, but it's handy :)

    >var a = new Uint8Array(5) 
    >a.set("Hello")
    >a
    =new Uint8Array([72,101,108,108,111])
    
About

Avatar for Gordon @Gordon started