Today I learned:
In my web app (next.js) I’m have a file ShippingPricing.res
which contains a list of cities with the prices to ship a package of 5 different sizes.
example:
let destinations = [
//... more destinations
{
city: `CDMX`,
cityId: "0000000766",
pricing: {
p500: list{1000., 2000., 3000., 4000., 5000.},
p1000: list{1500., 2500., 3500., 4500., 5500.},
},
},
]
I used to have destinations
be a list instead, until I realized that the size of the .bs.js
- 289 KB using
list{}
- 53 KB using array
In my local dev it doesn’t matter, but it is a big payload to send to the client
So I conclude that I should use arrays for hardcoding data instead of lists.