Wakamai-Fondue / wakamai-fondue-engine

The engine that powers Wakamai Fondue
Apache License 2.0
51 stars 12 forks source link

Lazy load unbrotli.js and inflate.js #18

Open pascalw opened 4 years ago

pascalw commented 4 years ago

Unbrotli.js and inflate.js account for most of the weight of this module (66.9 KB gzipped, out of 92 KB). Which of the two is needed depends on the type of font file that is analyzed, so lazy loading these modules as needed could save quite a few bits.

pascalw commented 4 years ago

@RoelN can you determine priority for this?

pascalw commented 4 years ago

I just came across https://github.com/101arrowz/fflate which could perhaps replace inflate.js. It's only 8kb min/gzipped, but could even be smaller with treeshaking since we don't need all supported algorithms.

RoelN commented 4 years ago

Hey, well spotted, thanks! Reading up on fflate, I saw tiny-inflate which might be an even better fit, as we only need decompression?

pascalw commented 4 years ago

Worth to consider indeed. That does seem to be quite a bit slower, but might be ok for our usecase. For inflate only fflate should also be only 3KB btw, it supports threeshaking.

RoelN commented 4 years ago

@pascalw I see your question for priority, sorry I missed that. It's one of the requirements before going live, so perhaps you could pick this up at your earliest convenience?