Reputation: 179
I checked the storage size but I'm confused when it comes to storing numbers.
In case of Bytes
, what does "Byte length" mean? If I store -128
what's the length? And in case of 12?
In case of Floating-point number and Integer, it doesn't matter if I store 325 or 9.9999999999999 it will always be 8 bytes?
In case of Array? Let' say we have ["ab", "bcd"], what's the size, (2+3=5)
or (2+1)+(3+1)=7
Upvotes: 0
Views: 293
Reputation: 317362
If you store an array of bytes, the size will simply be the length of that array. An array with a single byte value of -128 is still just one byte.
Yes, all numbers occupy the same 8-byte size, even if you don't see a fractional part.
The documentation says it's the sum of the array element sizes, so I would expect 7, the sum of the two individual string sizes, each encoded in UTF-8 + 1
Upvotes: 1