3 ms·
We compile/build JS on the fly per-request so we wouldn't be able to cache the JS ahead of time. The difference between brotli and zstd is 2.2ms at the 95th pe
by fastest963 3y ago
We compile/build JS on the fly per-request so we wouldn't be able to cache the JS ahead of time.
The difference between brotli and zstd is 2.2ms at the 95th percentile, at lower percentiles the differences are much smaller. This is still an area of active investigation/development for us. There are possibly content sizes where one is better than another. There are also probably tweaks on the server-side to improve the encoding time.
- eddd-ddde 3y agoUnrelated but I'm really curious what's the use case for sending custom js per request?
- fastest963 3y agoWe offer a lot of customization in our product so we can eliminate whole blocks or code if we know the customer doesn't have x turned on. We also have several geo-based products and so we know we don't need to send GDPR-related code to users in the USA for example. The goal is to ship the minimal amount of code to the end-user.
- gcr 3y agoI’d love to poke at this if you don’t mind. One advantage of downloading everything is that you only download it once. If the user is enabling/disabling features, you’ll have to then re-ship a new js bundle, no?
- eddd-ddde 3y agoAlso my thoughts. With something like Qwik you get tiny chunks that you only download when needed and are highly cacheable. All automated!
- fastest963 3y agoNot impossible for us to use something like that but remember that we are a vendor that sits on customer sites with very limited objectives we aren't powering a full-on webapp or multi-page experience. Typically we want to load our experience/component as quickly as possible after some sort of user interaction and the user interaction might have been from the customer's app/website.
- eddd-ddde 3y agoAh I see, that makes a lot of sense.
- fastest963 3y agoAt the scale we operate at we would probably have billions, if not tens or hundreds of billions, of downloads before any feature status is changed. Typically our customers are not turning on and off features very frequently.
- vlovich123 3y agoThat still doesn’t explain why you can’t cache. I would think that each code snippet itself is still cacheable. Or do you amalgamate all of them into a single download? Even still, I would expect most users to be fetching the same amalgamation, in which case caching should be beneficial…
- fastest963 3y agoWe do combine everything into a single file. To clarify, we use browser caching but we can't utilize any traditional CDN because if a customer embeds host.com/js as a JS file that path might be different for user A vs user B.