▲ 4 ▼ Persistent data structures with go
I've recently taken a liking to persistent data structures. These are data structures where instead of mutating data in-place, you are creating a new version of the data structures, that shares most of its state with the previous version. Not all data structures can be implemented efficiently like this, but those that do get a couple of immediate benefits - keeping old versions around allows you to get cheap snapshotting and copying. It is trivial to pass a copy to a different thread and you don't have to worry about concurrent writes, as neither actually mutates any shared state.
Register to comment or vote on this story