You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • This might be some help: http://www.espruino.com/Performance#every-datatype-in-espruino-is-based-on-a-single-storage-unit-12-16-bytes-

    But as you spotted, blocksize is 14, so each block is 14 bytes. So E.getSizeOf(Number.MAX_VALUE) being 1 means that single number takes up 14 bytes.

    Other examples:

    E.getSizeOf({}) == 1 // an object takes 1 var
    E.getSizeOf({a:42}) == 2 // small numbers can fit inside the variable name
    E.getSizeOf({a:1,b:2,c:3,d:4}) == 5 // small names + numbers packed together take 1 var each (+1 for the object)
    E.getSizeOf({a:123456}) == 3 // big numbers take more
    E.getSizeOf({a_really_big_var_name:123456}) == 5 // big variable names take more as well
    
About

Avatar for Gordon @Gordon started