alostsock / craftingway

A ffxiv crafting tool
https://craftingway.app/
MIT License
17 stars 5 forks source link

encode recipes with msgpackr #9

Closed raylu closed 1 year ago

raylu commented 1 year ago

netlify is using something around compression level 2 or 3:

$ curl 'https://craftingway.app/recipes.json' -H 'Accept-Encoding: gzip, deflate, br' -I
[...]
content-length: 183774

$ brotli -3vf public/recipes.json
Compressed [public/recipes.json]: 2.559 MiB -> 169.192 KiB

with msgpackr in records mode, I'm able to get something 41% smaller after brotli compression

$ brotli -3vf public/recipes.msgpack
Compressed [public/recipes.msgpack]: 480.569 KiB -> 118.525 KiB

there's also another 7 KiB of msgpackr JS

$ curl 'http://localhost:5173/node_modules/.vite/deps/msgpackr_unpack.js' -o m.js

$ brotli -3vf m.js
Compressed [m.js]: 31.917 KiB -> 7.470 KiB
alostsock commented 1 year ago

Sweet. Apparently this is even faster than JSON.parse, too.