Design patterns·Functional ideas that went mainstream
the new version copied five nodes rather than ten thousand elements, because everything unchanged is the same objects.
Structural sharing
Also calledshared structure, path copying
The technique that makes persistent data structures practical: an update copies only the path to the changed node and reuses every untouched subtree. It turns an apparent full copy into something logarithmic in the size of the structure. It only works because the shared parts are immutable, which is the clearest illustration of why immutability buys performance rather than only costing it.