3 ms·
Why is there more latency? Edit: Ah, I see OP's code requests the webp separately. You can avoid the extra request if you write a self-extracting html/webp pol
by Retr0id 2y ago
Why is there more latency?
Edit: Ah, I see OP's code requests the webp separately. You can avoid the extra request if you write a self-extracting html/webp polyglot file, as is typically done in the demoscene.
- BugsJustFindMe 2y agoIt takes more time for your message to get back and forth between your computer and the server than it takes for the server to pump out some extra bits. Even if you transmit the js stuff inline, the op's notion of time still just ignores the fact that it takes the caller time to even ask the server for the data in the first place, and at such small sizes that time swallows the time to transmit from the user's perspective.
- Retr0id 2y agoHere's a demo that only uses a single request for the whole page load: https://retr0.id/stuff/bee_movie.webp.html https://retr0.id/stuff/bee_movie.webp.html It is technically 2 requests, but the second one is a cache hit, in my testing.
- BugsJustFindMe 2y agoThat's fine, but if you're evaluating the amount of time it takes to load a webpage, you cannot ignore the time it takes for the client request to reach your server in the first place or for the client to then unpack the data. The time saved transmitting such a small number of bits will be a fraction of the time spent making that initial request anyway. That's all I'm saying. OP is only looking at transmit size differences, which is both not the same as transmit time differences and also not what the user actually experiences when requesting the page.
- purplesyringa 2y agoHmm? I'm not sure where you're taking that from. The webp is inlined.
- Retr0id 2y agoAh, so it is! I was skim-reading and stopped at `const result = await fetch("compressor/compressed.webp");`