5 ms·
Can't they use ML to predict where I'm going to click, and pre-cache the predicted page whenever the predicted button doesn't mutate important state? Or skip th
by energy123 2mo ago
Can't they use ML to predict where I'm going to click, and pre-cache the predicted page whenever the predicted button doesn't mutate important state? Or skip the difficult ML and have some basic rule of thumb that pre-caches frequent button clicks, using a markov chain, and conditioned on those pages being low bandwidth to pre-load.
- __MatrixMan__ 2mo agoIf we stored the edges (links) and nodes (pages) separately, rather than requiring you to blindly run a node's code just to discover what its edges might be, then you could skip the prediction and instead pre-cache the next hop for all edges just in case you follow one. You could even do this to two or three hops. This might seem wasteful, but if the web were content addressed instead of server addressed you could then be serving that cache to your municipality even after it became disconnected from the rest of the internet. Which sort of recasts it not like wastefulness but instead like fault tolerance and preparedness. We could maybe even dispense with the servers entirely. There are so many different ways to build a web. Why does it feel like we've landed on the worst possible one?
- Onavo 2mo ago> If we stored the edges (links) and nodes (pages) separately, rather than requiring you to blindly run a node's code just to discover what its edges might be, then you could skip the prediction and instead pre-cache the next hop for all edges just in case you follow one. You could even do this to two or three hops. Welcome to Next.js
- __MatrixMan__ 2mo agoCan next.js give me a page's links without requiring that I execute any code that I didn't have prior to visiting that page? The .js part makes me think not.
- pests 1mo agoSpeculative Rules API <script type="speculationrules"> { "prefetch": [ { "source": "list", "urls": ["/checkout.html", "/thank-you.html"] } ] } </script>
- __MatrixMan__ 1mo agoRight, but my browser doesn't interpret that. The site tells me to run some code which interprets it. I should be able to get the lay of the land without trusting the site enough to blindly execute whatever code it points me at. It's needless attack surface. Also it's not really pointing me at data, its pointing me a certain kinds of requests which I have to trust will be responded to consistently. I'd much rather have a hash so if I have that data lying around I can just forgo the request entirely and use what's present locally.
- pests 1mo agoThat is a browser API, there is no other code or script needed.
- charcircuit 1mo ago>but if the web were content addressed instead of server addressed you could then be serving that cache to your municipality even after it became disconnected from the rest of the internet. This is already possible without content addressing with CDNs. They can serve content from a local cache even when the host is disconnected from the internet.
- TeMPOraL 1mo agoAnd the first thing webdevs did once this became widely available, is change their apps to cache-bust their code; between that, and the short release periods in webshit ecosystem in general, and security and privacy considerations messing up things as usual, the promise of users mostly hitting just local cache with any marginal request, never materialized.
- __MatrixMan__ 1mo agoWithout content addressing how do I know that whoever holds the cache hasn't tampered with the content?
- charcircuit 1mo agoThe integrity attribute of the <link> element lets you provide a hash to ensure the content has not been tampered with.
- deleted 1mo ago[deleted]
- __MatrixMan__ 1mo agoInteresting. Is this common? Like, is there some way to enable it on my LAN so that when I become disconnected from the internet I can still browse pages which were cached by other devices on that LAN?
- charcircuit 1mo ago
- inigyou 1mo agoWe have that, it's called an <a> tag.
- __MatrixMan__ 1mo agoIts not stored separately, so: 1. You need write access to the server if you want to add one 2. The server could change its behavior at any time and there's no way to know that caches now need to be invalidated 3. If something goes wrong with connectivity or name resolution, there's no fallback since the authoritative thing was not something durable like a trusted human via a public key but rather an ephemeral thing: a named server which has pinkey promised to stay online. It asks the user to treat a server like a trustworthy source of perisisant data. But there's no reason to couple these kinds of trust. The skills necessary to persist and traffick data are orthogonal to being trustworthy about content. Coupling them creates needless load on single sources of failure which are simultaneously single points for corruption to target. Trust people, not servers. Use digital signatures to validate that what you're seeing came from those people. <a> tags are the opposite of this. They encourage us to trust servers by name, which isn't really working out.
- inigyou 1mo agoYou want people without write access to a website to be able to change how browsers access that website?
- supriyo-biswas 2mo ago> pre-caches frequent button clicks, using a markov chain I don't think the current crop of fullstack engineers would be hard pressed to know what a "markov chain" is, but in theory yes, you could emit a bunch of speculation rules[1] based on your predictions. I should also say that markov chain based approaches have been used for fraud detection, e.g. identifying checkout anomalies by detecting the sequence of web pages that they clicked on, amongst other factors. [1] https://developer.mozilla.org/en-US/docs/Web/API/Speculation_Rules_API https://developer.mozilla.org/en-US/docs/Web/API/Speculation...
- CalRobert 2mo agoHeh, this is how browser accelerators from the dial up era worked
- spaqin 2mo agoThe problem isn't in preloading, it's in how much data needs to be sent while quite probably most of the data could be either fetched on startup in an efficient format and rendered natively, or is completely unnecessary in the first place (telemetry, ads).
- markerz 2mo agoSo Next.JS actually pre-fetches links when they move into the viewport or you hover over it. It's interesting, but then you get wasted battery on mobile while on bad networks. The world is full of tradeoffs. Tech workers tend to want to consume more battery and data to be faster. Other people want to do less work. https://nextjs.org/docs/app/guides/prefetching#hover-triggered-prefetch https://nextjs.org/docs/app/guides/prefetching#hover-trigger... In my view, websites should not take seconds to load with gigabit fiber. Whatever happened to "mobile first"?
- rypskar 1mo agoI would assume a big part of software have plenty of lower hanging fruits for speedup and don't even profile to find where the bottlenecks are
- victorbjorklund 1mo agoThis exist but the downside is that it uses much more of your bandwidth and client resources (probably not matter in many cases but it does if on a phone in a country with bad connection) and your server resources (if not mostly static content)
- DeepSeaTortoise 1mo agoOh god, don't give them ideas. All ML is in-cloud AI now. I dread the day everything around my mouse movements needs to get tokenized and vibed into the ClosedAI cloud before my buttons start working again.
- zanderwohl 1mo agoMcMaster Carr website prefetches _all_ links upon hover. Saves you like half a second in many cases.
- inigyou 1mo agosegor.de goes one better and just downloads the entire catalogue when you first open it. About 2MB decompressed. Clicking and even searching is instant because it's all fully client side until you place an order. Funny thing is it apparently predates JSON. It's a bunch of data[foo][bar] = baz; - go look. (Website's in German obviously, and a surprising number of German electronic terms are very different from English. They use two different words for stranded and non-stranded wire.)