mcwhittemore / dyno-item-size

A simple node utility to calculate the size of a item as DynamoDB does.
14 stars 4 forks source link

Number calculation seems wrong #9

Open Dunge opened 5 years ago

Dunge commented 5 years ago

Not sure why you are converting to binary before calculating the string length, as far as I know it's based on the length of the number directly, not its binary representation. Also trailing 0 should be removed only if they are after the decimal point, not if let's say the number is 1000.

In any case, I have a item that Dynamo report using 10 write unit, but in your tool it report 27 write units and 26657bytes:

var item = { "0_0": 112.34568, "0_1": 112.34568, "10020_0": 279.345673, "10020_1": 279.345673, "10080_0": 280.345673, "10080_1": 280.345673, "10140_0": 281.345673, "10140_1": 281.345673, "10200_0": 282.345673, "10200_1": 282.345673, "1020_0": 129.345673, "1020_1": 129.345673, "10260_0": 283.345673, "10260_1": 283.345673, "10320_0": 284.345673, "10320_1": 284.345673, "10380_0": 285.345673, "10380_1": 285.345673, "10440_0": 286.345673, "10440_1": 286.345673, "10500_0": 287.345673, "10500_1": 287.345673, "10560_0": 288.345673, "10560_1": 288.345673, "10620_0": 289.345673, "10620_1": 289.345673, "10680_0": 290.345673, "10680_1": 290.345673, "10740_0": 291.345673, "10740_1": 291.345673, "10800_0": 292.345673, "10800_1": 292.345673, "1080_0": 130.345673, "1080_1": 130.345673, "10860_0": 293.345673, "10860_1": 293.345673, "10920_0": 294.345673, "10920_1": 294.345673, "10980_0": 295.345673, "10980_1": 295.345673, "11040_0": 296.345673, "11040_1": 296.345673, "11100_0": 297.345673, "11100_1": 297.345673, "11160_0": 298.345673, "11160_1": 298.345673, "11220_0": 299.345673, "11220_1": 299.345673, "11280_0": 300.345673, "11280_1": 300.345673, "11340_0": 301.345673, "11340_1": 301.345673, "11400_0": 302.345673, "11400_1": 302.345673, "1140_0": 131.345673, "1140_1": 131.345673, "11460_0": 303.345673, "11460_1": 303.345673, "11520_0": 304.345673, "11520_1": 304.345673, "11580_0": 305.345673, "11580_1": 305.345673, "11640_0": 306.345673, "11640_1": 306.345673, "11700_0": 307.345673, "11700_1": 307.345673, "11760_0": 308.345673, "11760_1": 308.345673, "11820_0": 309.345673, "11820_1": 309.345673, "11880_0": 310.345673, "11880_1": 310.345673, "11940_0": 311.345673, "11940_1": 311.345673, "12000_0": 312.345673, "12000_1": 312.345673, "1200_0": 132.345673, "1200_1": 132.345673, "12060_0": 313.345673, "12060_1": 313.345673, "120_0": 114.34568, "120_1": 114.34568, "12120_0": 314.345673, "12120_1": 314.345673, "12180_0": 315.345673, "12180_1": 315.345673, "12240_0": 316.345673, "12240_1": 316.345673, "12300_0": 317.345673, "12300_1": 317.345673, "12360_0": 318.345673, "12360_1": 318.345673, "12420_0": 319.345673, "12420_1": 319.345673, "12480_0": 320.345673, "12480_1": 320.345673, "12540_0": 321.345673, "12540_1": 321.345673, "12600_0": 322.345673, "12600_1": 322.345673, "1260_0": 133.345673, "1260_1": 133.345673, "12660_0": 323.345673, "12660_1": 323.345673, "12720_0": 324.345673, "12720_1": 324.345673, "12780_0": 325.345673, "12780_1": 325.345673, "12840_0": 326.345673, "12840_1": 326.345673, "12900_0": 327.345673, "12900_1": 327.345673, "12960_0": 328.345673, "12960_1": 328.345673, "13020_0": 329.345673, "13020_1": 329.345673, "13080_0": 330.345673, "13080_1": 330.345673, "13140_0": 331.345673, "13140_1": 331.345673, "13200_0": 332.345673, "13200_1": 332.345673, "1320_0": 134.345673, "1320_1": 134.345673, "13260_0": 333.345673, "13260_1": 333.345673, "13320_0": 334.345673, "13320_1": 334.345673, "13380_0": 335.345673, "13380_1": 335.345673, "13440_0": 336.345673, "13440_1": 336.345673, "13500_0": 337.345673, "13500_1": 337.345673, "13560_0": 338.345673, "13560_1": 338.345673, "13620_0": 339.345673, "13620_1": 339.345673, "13680_0": 340.345673, "13680_1": 340.345673, "13740_0": 341.345673, "13740_1": 341.345673, "13800_0": 342.345673, "13800_1": 342.345673, "1380_0": 135.345673, "1380_1": 135.345673, "13860_0": 343.345673, "13860_1": 343.345673, "13920_0": 344.345673, "13920_1": 344.345673, "13980_0": 345.345673, "13980_1": 345.345673, "14040_0": 346.345673, "14040_1": 346.345673, "14100_0": 347.345673, "14100_1": 347.345673, "14160_0": 348.345673, "14160_1": 348.345673, "14220_0": 349.345673, "14220_1": 349.345673, "14280_0": 350.345673, "14280_1": 350.345673, "14340_0": 351.345673, "14340_1": 351.345673, "14400_0": 352.345673, "14400_1": 352.345673, "1440_0": 136.345673, "1440_1": 136.345673, "14460_0": 353.345673, "14460_1": 353.345673, "14520_0": 354.345673, "14520_1": 354.345673, "14580_0": 355.345673, "14580_1": 355.345673, "14640_0": 356.345673, "14640_1": 356.345673, "14700_0": 357.345673, "14700_1": 357.345673, "14760_0": 358.345673, "14760_1": 358.345673, "14820_0": 359.345673, "14820_1": 359.345673, "14880_0": 360.345673, "14880_1": 360.345673, "14940_0": 361.345673, "14940_1": 361.345673, "15000_0": 362.345673, "15000_1": 362.345673, "1500_0": 137.345673, "1500_1": 137.345673, "15060_0": 363.345673, "15060_1": 363.345673, "15120_0": 364.345673, "15120_1": 364.345673, "15180_0": 365.345673, "15180_1": 365.345673, "15240_0": 366.345673, "15240_1": 366.345673, "15300_0": 367.345673, "15300_1": 367.345673, "15360_0": 368.345673, "15360_1": 368.345673, "15420_0": 369.345673, "15420_1": 369.345673, "15480_0": 370.345673, "15480_1": 370.345673, "15540_0": 371.345673, "15540_1": 371.345673, "15600_0": 372.345673, "15600_1": 372.345673, "1560_0": 138.345673, "1560_1": 138.345673, "15660_0": 373.345673, "15660_1": 373.345673, "15720_0": 374.345673, "15720_1": 374.345673, "15780_0": 375.345673, "15780_1": 375.345673, "15840_0": 376.345673, "15840_1": 376.345673, "15900_0": 377.345673, "15900_1": 377.345673, "15960_0": 378.345673, "15960_1": 378.345673, "16020_0": 379.345673, "16020_1": 379.345673, "16080_0": 380.345673, "16080_1": 380.345673, "16140_0": 381.345673, "16140_1": 381.345673, "16200_0": 382.345673, "16200_1": 382.345673, "1620_0": 139.345673, "1620_1": 139.345673, "16260_0": 383.345673, "16260_1": 383.345673, "16320_0": 384.345673, "16320_1": 384.345673, "16380_0": 385.345673, "16380_1": 385.345673, "16440_0": 386.345673, "16440_1": 386.345673, "16500_0": 387.345673, "16500_1": 387.345673, "16560_0": 388.345673, "16560_1": 388.345673, "16620_0": 389.345673, "16620_1": 389.345673, "16680_0": 390.345673, "16680_1": 390.345673, "16740_0": 391.345673, "16740_1": 391.345673, "16800_0": 392.345673, "16800_1": 392.345673, "1680_0": 140.345673, "1680_1": 140.345673, "16860_0": 393.345673, "16860_1": 393.345673, "16920_0": 394.345673, "16920_1": 394.345673, "16980_0": 395.345673, "16980_1": 395.345673, "17040_0": 396.345673, "17040_1": 396.345673, "17100_0": 397.345673, "17100_1": 397.345673, "17160_0": 398.345673, "17160_1": 398.345673, "17220_0": 399.345673, "17220_1": 399.345673, "17280_0": 400.345673, "17280_1": 400.345673, "17340_0": 401.345673, "17340_1": 401.345673, "17400_0": 402.345673, "17400_1": 402.345673, "1740_0": 141.345673, "1740_1": 141.345673, "17460_0": 403.345673, "17460_1": 403.345673, "17520_0": 404.345673, "17520_1": 404.345673, "17580_0": 405.345673, "17580_1": 405.345673, "17640_0": 406.345673, "17640_1": 406.345673, "17700_0": 407.345673, "17700_1": 407.345673, "17760_0": 408.345673, "17760_1": 408.345673, "17820_0": 409.345673, "17820_1": 409.345673, "17880_0": 410.345673, "17880_1": 410.345673, "17940_0": 411.345673, "17940_1": 411.345673, "18000_0": 412.345673, "18000_1": 412.345673, "1800_0": 142.345673, "1800_1": 142.345673, "18060_0": 413.345673, "18060_1": 413.345673, "180_0": 115.34568, "180_1": 115.34568, "18120_0": 414.345673, "18120_1": 414.345673, "18180_0": 415.345673, "18180_1": 415.345673, "18240_0": 416.345673, "18240_1": 416.345673, "18300_0": 417.345673, "18300_1": 417.345673, "18360_0": 418.345673, "18360_1": 418.345673, "18420_0": 419.345673, "18420_1": 419.345673, "18480_0": 420.345673, "18480_1": 420.345673, "18540_0": 421.345673, "18540_1": 421.345673, "18600_0": 422.345673, "18600_1": 422.345673, "1860_0": 143.345673, "1860_1": 143.345673, "18660_0": 423.345673, "18660_1": 423.345673, "18720_0": 424.345673, "18720_1": 424.345673, "18780_0": 425.345673, "18780_1": 425.345673, "18840_0": 426.345673, "18840_1": 426.345673, "18900_0": 427.345673, "18900_1": 427.345673, "18960_0": 428.345673, "18960_1": 428.345673, "19020_0": 429.345673, "19020_1": 429.345673, "19080_0": 430.345673, "19080_1": 430.345673, "19140_0": 431.345673, "19140_1": 431.345673, "19200_0": 432.345673, "19200_1": 432.345673, "1920_0": 144.345673, "1920_1": 144.345673, "19260_0": 433.345673, "19260_1": 433.345673, "19320_0": 434.345673, "19320_1": 434.345673, "19380_0": 435.345673, "19380_1": 435.345673, "19440_0": 436.345673, "19440_1": 436.345673, "19500_0": 437.345673, "19500_1": 437.345673, "19560_0": 438.345673, "19560_1": 438.345673, "19620_0": 439.345673, "19620_1": 439.345673, "19680_0": 440.345673, "19680_1": 440.345673, "19740_0": 441.345673, "19740_1": 441.345673, "19800_0": 442.345673, "19800_1": 442.345673, "1980_0": 145.345673, "1980_1": 145.345673, "19860_0": 443.345673, "19860_1": 443.345673, "19920_0": 444.345673, "19920_1": 444.345673, "19980_0": 445.345673, "19980_1": 445.345673, "20040_0": 446.345673, "20040_1": 446.345673, "20100_0": 447.345673, "20100_1": 447.345673, "20160_0": 448.345673, "20160_1": 448.345673, "20220_0": 449.345673, "20220_1": 449.345673, "20280_0": 450.345673, "20280_1": 450.345673, "20340_0": 451.345673, "20340_1": 451.345673, "20400_0": 452.345673, "20400_1": 452.345673, "2040_0": 146.345673, "2040_1": 146.345673, "20460_0": 453.345673, "20460_1": 453.345673, "20520_0": 454.345673, "20520_1": 454.345673, "20580_0": 455.345673, "20580_1": 455.345673, "20640_0": 456.345673, "20640_1": 456.345673, "20700_0": 457.345673, "20700_1": 457.345673, "20760_0": 458.345673, "20760_1": 458.345673, "20820_0": 459.345673, "20820_1": 459.345673, "20880_0": 460.345673, "20880_1": 460.345673, "20940_0": 461.345673, "20940_1": 461.345673, "21000_0": 462.345673, "21000_1": 462.345673, "2100_0": 147.345673, "2100_1": 147.345673, "21060_0": 463.345673, "21060_1": 463.345673, "21120_0": 464.345673, "21120_1": 464.345673, "21180_0": 465.345673, "21180_1": 465.345673, "21240_0": 466.345673, "21240_1": 466.345673, "21300_0": 467.345673, "21300_1": 467.345673, "21360_0": 468.345673, "21360_1": 468.345673, "21420_0": 469.345673, "21420_1": 469.345673, "21480_0": 470.345673, "21480_1": 470.345673, "21540_0": 471.345673, "21540_1": 471.345673, "21600_0": 472.345673, "21600_1": 472.345673, "2160_0": 148.345673, "2160_1": 148.345673, "21660_0": 473.345673, "21660_1": 473.345673, "21720_0": 474.345673, "21720_1": 474.345673, "21780_0": 475.345673, "21780_1": 475.345673, "21840_0": 476.345673, "21840_1": 476.345673, "21900_0": 477.345673, "21900_1": 477.345673, "21960_0": 478.345673, "21960_1": 478.345673, "22020_0": 479.345673, "22020_1": 479.345673, "22080_0": 480.345673, "22080_1": 480.345673, "22140_0": 481.345673, "22140_1": 481.345673, "22200_0": 482.345673, "22200_1": 482.345673, "2220_0": 149.345673, "2220_1": 149.345673, "22260_0": 483.345673, "22260_1": 483.345673, "22320_0": 484.345673, "22320_1": 484.345673, "22380_0": 485.345673, "22380_1": 485.345673, "22440_0": 486.345673, "22440_1": 486.345673, "22500_0": 487.345673, "22500_1": 487.345673, "22560_0": 488.345673, "22560_1": 488.345673, "22620_0": 489.345673, "22620_1": 489.345673, "22680_0": 490.345673, "22680_1": 490.345673, "22740_0": 491.345673, "22740_1": 491.345673, "22800_0": 492.345673, "22800_1": 492.345673, "2280_0": 150.345673, "2280_1": 150.345673, "22860_0": 493.345673, "22860_1": 493.345673, "22920_0": 494.345673, "22920_1": 494.345673, "22980_0": 495.345673, "22980_1": 495.345673, "23040_0": 496.345673, "23040_1": 496.345673, "23100_0": 497.345673, "23100_1": 497.345673, "23160_0": 498.345673, "23160_1": 498.345673, "23220_0": 499.345673, "23220_1": 499.345673, "23280_0": 500.345673, "23280_1": 500.345673, "23340_0": 501.345673, "23340_1": 501.345673, "23400_0": 502.345673, "23400_1": 502.345673, "2340_0": 151.345673, "2340_1": 151.345673, "23460_0": 503.345673, "23460_1": 503.345673, "23520_0": 504.345673, "23520_1": 504.345673, "23580_0": 505.345673, "23580_1": 505.345673, "23640_0": 506.345673, "23640_1": 506.345673, "23700_0": 507.345673, "23700_1": 507.345673, "23760_0": 508.345673, "23760_1": 508.345673, "23820_0": 509.345673, "23820_1": 509.345673, "23880_0": 510.345673, "23880_1": 510.345673, "23940_0": 511.345673, "23940_1": 511.345673, "24000_0": 512.345703, "24000_1": 512.345703, "2400_0": 152.345673, "2400_1": 152.345673, "24060_0": 513.345703, "24060_1": 513.345703, "240_0": 116.34568, "240_1": 116.34568, "24120_0": 514.345703, "24120_1": 514.345703, "24180_0": 515.345703, "24180_1": 515.345703, "24240_0": 516.345703, "24240_1": 516.345703, "24300_0": 517.345703, "24300_1": 517.345703, "24360_0": 518.345703, "24360_1": 518.345703, "24420_0": 519.345703, "24420_1": 519.345703, "24480_0": 520.345703, "24480_1": 520.345703, "24540_0": 521.345703, "24540_1": 521.345703, "24600_0": 522.345703, "24600_1": 522.345703, "2460_0": 153.345673, "2460_1": 153.345673, "24660_0": 523.345703, "24660_1": 523.345703, "24720_0": 524.345703, "24720_1": 524.345703, "24780_0": 525.345703, "24780_1": 525.345703, "24840_0": 526.345703, "24840_1": 526.345703, "24900_0": 527.345703, "24900_1": 527.345703, "24960_0": 528.345703, "24960_1": 528.345703, "25020_0": 529.345703, "25020_1": 529.345703, "25080_0": 530.345703, "25080_1": 530.345703, "25140_0": 531.345703, "25140_1": 531.345703, "25200_0": 532.345703, "25200_1": 532.345703, "2520_0": 154.345673, "2520_1": 154.345673, "25260_0": 533.345703, "25260_1": 533.345703, "25320_0": 534.345703, "25320_1": 534.345703, "25380_0": 535.345703, "25380_1": 535.345703, "25440_0": 536.345703, "25440_1": 536.345703, "25500_0": 537.345703, "25500_1": 537.345703, "25560_0": 538.345703, "25560_1": 538.345703, "25620_0": 539.345703, "25620_1": 539.345703, "25680_0": 540.345703, "25680_1": 540.345703, "25740_0": 541.345703, "25740_1": 541.345703, "25800_0": 542.345703, "25800_1": 542.345703, "2580_0": 155.345673, "2580_1": 155.345673, "25860_0": 543.345703, "25860_1": 543.345703, "25920_0": 544.345703, "25920_1": 544.345703, "25980_0": 545.345703, "25980_1": 545.345703, "26040_0": 546.345703, "26040_1": 546.345703, "26100_0": 547.345703, "26100_1": 547.345703, "26160_0": 548.345703, "26160_1": 548.345703, "26220_0": 549.345703, "26220_1": 549.345703, "26280_0": 550.345703, "26280_1": 550.345703, "26340_0": 551.345703, "26340_1": 551.345703, "26400_0": 552.345703, "26400_1": 552.345703, "2640_0": 156.345673, "2640_1": 156.345673, "26460_0": 553.345703, "26460_1": 553.345703, "26520_0": 554.345703, "26520_1": 554.345703, "26580_0": 555.345703, "26580_1": 555.345703, "26640_0": 556.345703, "26640_1": 556.345703, "26700_0": 557.345703, "26700_1": 557.345703, "26760_0": 558.345703, "26760_1": 558.345703, "26820_0": 559.345703, "26820_1": 559.345703, "26880_0": 560.345703, "26880_1": 560.345703, "26940_0": 561.345703, "26940_1": 561.345703, "27000_0": 562.345703, "27000_1": 562.345703, "2700_0": 157.345673, "2700_1": 157.345673, "27060_0": 563.345703, "27060_1": 563.345703, "27120_0": 564.345703, "27120_1": 564.345703, "27180_0": 565.345703, "27180_1": 565.345703, "27240_0": 566.345703, "27240_1": 566.345703, "27300_0": 567.345703, "27300_1": 567.345703, "27360_0": 568.345703, "27360_1": 568.345703, "27420_0": 569.345703, "27420_1": 569.345703, "27480_0": 570.345703, "27480_1": 570.345703, "27540_0": 571.345703, "27540_1": 571.345703, "27600_0": 572.345703, "27600_1": 572.345703, "2760_0": 158.345673, "2760_1": 158.345673, "27660_0": 573.345703, "27660_1": 573.345703, "27720_0": 574.345703, "27720_1": 574.345703, "27780_0": 575.345703, "27780_1": 575.345703, "27840_0": 576.345703, "27840_1": 576.345703, "27900_0": 577.345703, "27900_1": 577.345703, "27960_0": 578.345703, "27960_1": 578.345703, "28020_0": 579.345703, "28020_1": 579.345703, "28080_0": 580.345703, "28080_1": 580.345703, "28140_0": 581.345703, "28140_1": 581.345703, "28200_0": 582.345703, "28200_1": 582.345703, "2820_0": 159.345673, "2820_1": 159.345673, "28260_0": 583.345703, "28260_1": 583.345703, "28320_0": 584.345703, "28320_1": 584.345703, "28380_0": 585.345703, "28380_1": 585.345703, "28440_0": 586.345703, "28440_1": 586.345703, "28500_0": 587.345703, "28500_1": 587.345703, "28560_0": 588.345703, "28560_1": 588.345703, "28620_0": 589.345703, "28620_1": 589.345703, "28680_0": 590.345703, "28680_1": 590.345703, "28740_0": 591.345703, "28740_1": 591.345703, "28800_0": 592.345703, "28800_1": 592.345703, "2880_0": 160.345673, "2880_1": 160.345673, "28860_0": 593.345703, "28860_1": 593.345703, "28920_0": 594.345703, "28920_1": 594.345703, "28980_0": 595.345703, "28980_1": 595.345703, "29040_0": 596.345703, "29040_1": 596.345703, "29100_0": 597.345703, "29100_1": 597.345703, "29160_0": 598.345703, "29160_1": 598.345703, "29220_0": 599.345703, "29220_1": 599.345703, "29280_0": 600.345703, "29280_1": 600.345703, "29340_0": 601.345703, "29340_1": 601.345703, "29400_0": 602.345703, "29400_1": 602.345703, "2940_0": 161.345673, "2940_1": 161.345673, "29460_0": 603.345703, "29460_1": 603.345703, "29520_0": 604.345703, "29520_1": 604.345703, "29580_0": 605.345703, "29580_1": 605.345703, "29640_0": 606.345703, "29640_1": 606.345703, "29700_0": 607.345703, "29700_1": 607.345703, "29760_0": 608.345703, "29760_1": 608.345703, "29820_0": 609.345703, "29820_1": 609.345703, "29880_0": 610.345703, "29880_1": 610.345703, "29940_0": 611.345703, "29940_1": 611.345703, "3000_0": 162.345673, "3000_1": 162.345673, "300_0": 117.34568, "300_1": 117.34568, "3060_0": 163.345673, "3060_1": 163.345673, "3120_0": 164.345673, "3120_1": 164.345673, "3180_0": 165.345673, "3180_1": 165.345673, "3240_0": 166.345673, "3240_1": 166.345673, "3300_0": 167.345673, "3300_1": 167.345673, "3360_0": 168.345673, "3360_1": 168.345673, "3420_0": 169.345673, "3420_1": 169.345673, "3480_0": 170.345673, "3480_1": 170.345673, "3540_0": 171.345673, "3540_1": 171.345673, "3600_0": 172.345673, "3600_1": 172.345673, "360_0": 118.34568, "360_1": 118.34568, "3660_0": 173.345673, "3660_1": 173.345673, "3720_0": 174.345673, "3720_1": 174.345673, "3780_0": 175.345673, "3780_1": 175.345673, "3840_0": 176.345673, "3840_1": 176.345673, "3900_0": 177.345673, "3900_1": 177.345673, "3960_0": 178.345673, "3960_1": 178.345673, "4020_0": 179.345673, "4020_1": 179.345673, "4080_0": 180.345673, "4080_1": 180.345673, "4140_0": 181.345673, "4140_1": 181.345673, "4200_0": 182.345673, "4200_1": 182.345673, "420_0": 119.34568, "420_1": 119.34568, "4260_0": 183.345673, "4260_1": 183.345673, "4320_0": 184.345673, "4320_1": 184.345673, "4380_0": 185.345673, "4380_1": 185.345673, "4440_0": 186.345673, "4440_1": 186.345673, "4500_0": 187.345673, "4500_1": 187.345673, "4560_0": 188.345673, "4560_1": 188.345673, "4620_0": 189.345673, "4620_1": 189.345673, "4680_0": 190.345673, "4680_1": 190.345673, "4740_0": 191.345673, "4740_1": 191.345673, "4800_0": 192.345673, "4800_1": 192.345673, "480_0": 120.34568, "480_1": 120.34568, "4860_0": 193.345673, "4860_1": 193.345673, "4920_0": 194.345673, "4920_1": 194.345673, "4980_0": 195.345673, "4980_1": 195.345673, "5040_0": 196.345673, "5040_1": 196.345673, "5100_0": 197.345673, "5100_1": 197.345673, "5160_0": 198.345673, "5160_1": 198.345673, "5220_0": 199.345673, "5220_1": 199.345673, "5280_0": 200.345673, "5280_1": 200.345673, "5340_0": 201.345673, "5340_1": 201.345673, "5400_0": 202.345673, "5400_1": 202.345673, "540_0": 121.34568, "540_1": 121.34568, "5460_0": 203.345673, "5460_1": 203.345673, "5520_0": 204.345673, "5520_1": 204.345673, "5580_0": 205.345673, "5580_1": 205.345673, "5640_0": 206.345673, "5640_1": 206.345673, "5700_0": 207.345673, "5700_1": 207.345673, "5760_0": 208.345673, "5760_1": 208.345673, "5820_0": 209.345673, "5820_1": 209.345673, "5880_0": 210.345673, "5880_1": 210.345673, "5940_0": 211.345673, "5940_1": 211.345673, "6000_0": 212.345673, "6000_1": 212.345673, "600_0": 122.34568, "600_1": 122.34568, "6060_0": 213.345673, "6060_1": 213.345673, "60_0": 113.34568, "60_1": 113.34568, "6120_0": 214.345673, "6120_1": 214.345673, "6180_0": 215.345673, "6180_1": 215.345673, "6240_0": 216.345673, "6240_1": 216.345673, "6300_0": 217.345673, "6300_1": 217.345673, "6360_0": 218.345673, "6360_1": 218.345673, "6420_0": 219.345673, "6420_1": 219.345673, "6480_0": 220.345673, "6480_1": 220.345673, "6540_0": 221.345673, "6540_1": 221.345673, "6600_0": 222.345673, "6600_1": 222.345673, "660_0": 123.34568, "660_1": 123.34568, "6660_0": 223.345673, "6660_1": 223.345673, "6720_0": 224.345673, "6720_1": 224.345673, "6780_0": 225.345673, "6780_1": 225.345673, "6840_0": 226.345673, "6840_1": 226.345673, "6900_0": 227.345673, "6900_1": 227.345673, "6960_0": 228.345673, "6960_1": 228.345673, "7020_0": 229.345673, "7020_1": 229.345673, "7080_0": 230.345673, "7080_1": 230.345673, "7140_0": 231.345673, "7140_1": 231.345673, "7200_0": 232.345673, "7200_1": 232.345673, "720_0": 124.34568, "720_1": 124.34568, "7260_0": 233.345673, "7260_1": 233.345673, "7320_0": 234.345673, "7320_1": 234.345673, "7380_0": 235.345673, "7380_1": 235.345673, "7440_0": 236.345673, "7440_1": 236.345673, "7500_0": 237.345673, "7500_1": 237.345673, "7560_0": 238.345673, "7560_1": 238.345673, "7620_0": 239.345673, "7620_1": 239.345673, "7680_0": 240.345673, "7680_1": 240.345673, "7740_0": 241.345673, "7740_1": 241.345673, "7800_0": 242.345673, "7800_1": 242.345673, "780_0": 125.34568, "780_1": 125.34568, "7860_0": 243.345673, "7860_1": 243.345673, "7920_0": 244.345673, "7920_1": 244.345673, "7980_0": 245.345673, "7980_1": 245.345673, "8040_0": 246.345673, "8040_1": 246.345673, "8100_0": 247.345673, "8100_1": 247.345673, "8160_0": 248.345673, "8160_1": 248.345673, "8220_0": 249.345673, "8220_1": 249.345673, "8280_0": 250.345673, "8280_1": 250.345673, "8340_0": 251.345673, "8340_1": 251.345673, "8400_0": 252.345673, "8400_1": 252.345673, "840_0": 126.34568, "840_1": 126.34568, "8460_0": 253.345673, "8460_1": 253.345673, "8520_0": 254.345673, "8520_1": 254.345673, "8580_0": 255.345673, "8580_1": 255.345673, "8640_0": 256.345673, "8640_1": 256.345673, "8700_0": 257.345673, "8700_1": 257.345673, "8760_0": 258.345673, "8760_1": 258.345673, "8820_0": 259.345673, "8820_1": 259.345673, "8880_0": 260.345673, "8880_1": 260.345673, "8940_0": 261.345673, "8940_1": 261.345673, "9000_0": 262.345673, "9000_1": 262.345673, "900_0": 127.34568, "900_1": 127.34568, "9060_0": 263.345673, "9060_1": 263.345673, "9120_0": 264.345673, "9120_1": 264.345673, "9180_0": 265.345673, "9180_1": 265.345673, "9240_0": 266.345673, "9240_1": 266.345673, "9300_0": 267.345673, "9300_1": 267.345673, "9360_0": 268.345673, "9360_1": 268.345673, "9420_0": 269.345673, "9420_1": 269.345673, "9480_0": 270.345673, "9480_1": 270.345673, "9540_0": 271.345673, "9540_1": 271.345673, "9600_0": 272.345673, "9600_1": 272.345673, "960_0": 128.345673, "960_1": 128.345673, "9660_0": 273.345673, "9660_1": 273.345673, "9720_0": 274.345673, "9720_1": 274.345673, "9780_0": 275.345673, "9780_1": 275.345673, "9840_0": 276.345673, "9840_1": 276.345673, "9900_0": 277.345673, "9900_1": 277.345673, "9960_0": 278.345673, "9960_1": 278.345673, "Id": "9999_Position", "T": 1577670000 };

jmhummel commented 5 years ago

Not sure why you are converting to binary before calculating the string length, as far as I know it's based on the length of the number directly, not its binary representation

Should be fixed now by this PR: https://github.com/mcwhittemore/dyno-item-size/pull/7

Also trailing 0 should be removed only if they are after the decimal point, not if let's say the number is 1000.

Not sure I agree. Based on the official docs, all numbers are stored as decimals in Scientific Notation. So 1000 should be in the form as 1E3 (1 * 10^3).

It at most, take up two bytes, one for the significant, and one for the signed exponent. So perhaps, in decimal: 1 131 (3 represented as 131 when signed with the first bit), hex: 0x0183, and binary: 0000 0001 1000 0011

However, It's representation in Dynamo may be only one byte if they are doing something clever with the extra bits (only 7 needed to represent two digits). It wouldn't surprise me if AWS took advantage of any unused bytes to further reduce the size.