mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
* fix(dynamodb): size numbers by base-100 digit pairs
DynamoDB stores a number as base-100 digits paired from the decimal point.
It costs one byte per pair plus one, and one more when negative. Floci
counted the characters of the number text, so items full of numbers hit
the 400 KB limit too early or too late, and capacity was off too.
On AWS, 110 and 0.015 cost 3 bytes, 1100 and 0.0015 cost 2, 3.14159
costs 5 and 1E125 costs 2.
* fix(dynamodb): drop the sign byte at 20 pairs and survive huge exponents
On AWS a negative number of 20 base-100 pairs costs 21 bytes, the same as
a positive one. Below 20 pairs it costs one byte more.
A number whose exponent overflows BigDecimal's scale now falls back to its
text length instead of throwing, and the pair math runs in long.
* fix(dynamodb): brace the number size branch
* fix(dynamodb): charge a number set only for its members
On AWS an NS set costs the sum of its members and nothing per member.
{"NS":["1"]} costs 2 bytes like {"N":"1"}, and ["1","2","3"] costs 6.