3 ms·
> They reuse shared data, similar to how Git only tracks the delta's between commits, rather than multiple, full copies of the file. I learned about immutable
by adambyrtek 6y ago
> They reuse shared data, similar to how Git only tracks the delta's between commits, rather than multiple, full copies of the file.
I learned about immutable data structures at Rich's conference talk years ago, and the whole concept blew my mind as well. However, what you said above is not strictly correct. The idea is not to store deltas (which is what Subversion does), but immutable copies of objects (in case of Git identified by their SHA-1) that can be used to build multiple versions of a hierarchical data structure (e.g. a list, tree or hash map). Git commit is basically a tree of other objects with some metadata. The problem with deltas is that they need to be iteratively applied to some base snapshot which requires computation (and probably a cache as well), while immutable objects are easily accessible in constant time.
- elamje 6y agoAgree. Probably should’ve used a more solid example, but was just trying to convey the essence I suppose.
- adambyrtek 6y agoNo worries, I fully agree with the rest and just wanted to clarify things for others, not nitpick.