Hey, it sounds great, right? you have this huge app which costs people a lot of time to download and you would like to save them time downloading it.
So why not calculate some difference and only send that?
Patching text files (esp source) works best for small localized changes.
Here's an example:
Old:const char message[]="Unable to load library because:%s";
New:const char message[]="Unable to load library because: %s";
OK, so how expensive is the diff for this change? probably less than five lines.
OK, so for small changes to source files it can be worth it.
old | new |
---|---|
<a> <b/> </a> |
For your standard diff application, the patch is 10+ lines. and frequently a change like this affects the entire file (ignoring the license which probably shouldn't have been shipped in the first place). So you have a 50 line file and a 110 line diff. This would of course never be worth it.
OK, so perhaps standard diff is bad. what about an xml xpath based diff application. especially if whitespace doesn't matter. well, that's an interesting question. i can't answer it. i tried looking for such an app and couldn't find one.
So how do changes happen in mozilla binary files? well frequently we change an API in xpcom or some other core library and all users of it have to change. Now it's true that a change could be as simple as changing the spelling of a function, but generally the API change affects the entire calling convention.
instead of:
- void ProcessPendingReqests(); + void ProcessPendingRequests();
and a few matching changes to the callers. we have things like:
nsresult nsIContent::GetDocument(nsIDocument **aDoc); nsIDocument * nsIContent::GetDocument();
Such a change will affect hundreds of files and significantly change both the source code and the generated binary code.
For some types of changes you can recycle patches (e.g. a change which says replace all instances of ' teh ' with ' the ', or if you happen to shift the location of a global function by a certain amount) but for the binary changes like the ones that change calling conventions the adjacent code is likely to be very different and you won't be able to use a simple drop in replacement system.
OK, so that's nice.