One of the authors of the dynoSRC hackathon project here.
Thanks for the link! I wasn't aware of this white paper. Would be great to integrate this as an automatic feature in the dynoSRC express middleware. I've added an issue for us to look into (and implement if feasible) SDCH here: https://github.com/diurnalist/dynosrc/issues/3
If you have any kind of JS minification in your pipeline, then just applying git diff is likely to produce large patches for small changes as renaming and compiler optimizations on Javascript can vary wildly.
Google has had diff tools like this for awhile, as such, the Closure Compiler contains a feature called stable name maps to prevent a small change from causing all of the symbols globally to be minified differently. It's outputs two files of variable and property names, and subsequent compilers can attempt to minimize diff-cheese. They also help SDCH.
DynoSRC will actually insert white space into minified files before doing the diff so it can still do line diffs. We were and are concerned about the overhead of a diff on the minfication use-case, but it's promising that some minifiers like Closure have settings you can use to ensure that two versions of a file will match up relatively well when minified. Thanks for the link!
The problem here is that this could remove your ability to use localstorage in your application for anything but your JS source. We were hitting issues with some browser's 2-3MB limit when storing data for offline use.
I believe it's at least 5MB on all major browsers (that support it).... but I think text is stored UTF-16, so that gets used up more quickly than you might expect.
Hmm, good point. Given that we conceptualized and implemented the first iteration of this over a hackathon, I'm not surprised we missed some important things ;)
Gate One already does this (though it sends whole files not just the diffs). Once a client has an asset (JS, CSS) there's no reason for it to be re-downloaded unless there's a change.
Another improvement in Gate One's implementation is that it uses IndexedDB instead of localStorage. This is significantly more performant--especially as you add more/larger assets (localStorage blocks--always--whenever it is used).
It also downloads all assets over the WebSocket connection which has significantly improved performance over multiple GET requests. It's quite fast.
Caching with localStorage is not new, the whole point is sending diffs for changes instead of re-downloading everything. This improves performance even for very dynamic data that is constantly refreshed.
I remember seeing something similar to this a while back called Diffable http://googlediffable.blogspot.com/. Looks like the same thing but maybe I'm wrong... Still cool though.
This is a neat idea, but a problem I didn't see discussed in the article is that on iOS (at least), LocalStorage is disabled when running in private mode.
There are ways to detect it and work around it obviously but considering this is pitched as a solution for mobile users, it's probably something to consider.
Good point. I believe if the cache is disabled the fallback behavior will be that all the JS assets just get inlined in full on the page, which is still arguably better than requiring an extra HTTP request. I haven't tested this yet, though, so it may not work out of the box yet.
CloudFlare also does something similar within their own network, they call it Railgun: http://blog.cloudflare.com/railgun-in-the-real-world