KRkragen·Nov 22, 2014
You could make a shallow clone with just the objects you need for the front page. If we're taking Git literally here, you need to get the current head somehow, then fetch the commit object, then fetch the root directory object it points to, then fetch the index.html blob object it points to. If we're not using HTTP URLs to name the objects, and the objects in question are small, it would be pretty easy to configure the server to "optimistically" bundle the commit, the directory, and the blob into the response to the request for the head, so it could be a single RTT.
It might actually be more efficient to do a single-version shallow clone than to fetch all the relevant assets with separate HTTP requests. Git already supports shallow clones, and you can already use them to clone things like Github wikis, and now you can even push from th
Read the rest
em: https://stackoverflow.com/questions/6941889/is-git-clone-dep.... A --depth 1 clone of https://github.com/kragen/500lines is 7 megabytes, although the full history is only barely larger. My phone has 400+ megabytes of RAM.
More promisingly, though, Git blobs are identified by their hashes. That means that if both my home page and your home page use Twitter Bootstrap 2.3.2, your phone only needs to download it once to render both home pages, since it can see from the blob IDs in the Git directory that it already has the relevant blobs. (Assuming it hasn't been optimistically included in the initial message response!) It doesn't have to worry that one of us might be serving up a maliciously-backdoored version in order to steal users' login cookies on the other's site. By the same token, you can accept the blobs from anyone who has a copy, who might be closer to you on the network than the origin server. Especially if, like me, you're in Argentina with a 250ms ping time to the US.
(This assumes you're using something cleverer than the standard git clone protocol, which builds a thin pack including all the objects you lack.)
So git-cloning websites to view them could actually be faster than loading them over HTTP the way we do it now, because it eliminates a lot of the unnecessary security issues that we work around with bandwidth duplication and high latency.