feat: support routing prefetching and trustless gateways preconnects#980
feat: support routing prefetching and trustless gateways preconnects#980aschmahmann wants to merge 1 commit intomainfrom
Conversation
6340e93 to
24f00e7
Compare
|
Interesting, I wonder if we could first try it with rel=preconnect for |
Is there any way (aside from requests where the entire data is in an identity multihash like bafkqaaka.ipfs.inbrowser.link) where we don't end up making one of the listed fetch requests? i.e.
Starting with this and then comparing the performance of prefetch vs preconnect after seems fine, but again AFAICT we're always going to hit this endpoint unless it's for identity multihash requests where no networking is needed.
Seems reasonable to me, I'd rather users fetch directly when possible rather than relying on the public infra here, but IIUC we use it for most requests anyway (i.e. it will race with the delegated routing lookup which needs to happen before retrieving from anyone else). |
| const hasActiveWorker = registration?.active != null | ||
|
|
||
| if (!hasActiveWorker) { | ||
| prewarmContentRequest(request, config) |
There was a problem hiding this comment.
We discussed this briefly during colo, I had slight concern that executing prewarm code in the main page may backfire
- due to the way JS is execurted and sheduled by V8, it may slow things down (execution, request ordering)
- we end up with redundant requests
Not against it, just noting we should measure if there is visible improvement on top of other things like hints alone (#984 etc)
Support routing prefetching and trustless gateways preconnects
Description
Closes #979. The idea here is to parallelize requests the service worker is likely to make with the installation of the service worker itself.
Notes & open questions
Some todo / outstanding items:
Note: This was generated with LLM help, if there's a better way to solve #979 or if we want to start with something small like hard-coded preconnects instead of the complexity involved with the prefetches that's fine by me. There are some tests here, but idk if there are reasonable ways to do end-to-end testing here.
Change checklist
[ ] I have made corresponding changes to the documentation if necessary (this includes comments as well)