
Fast Ordered Collections for Swift Using In-Memory B-Trees - ingve
https://github.com/lorentey/BTree
======
lemoncucumber
Sounds very similar to the copy-on-write-friendly b-trees used in Btrfs,
originally researched by by Ohad Rodeh: [http://liw.fi/larch/ohad-btrees-
shadowing-clones.pdf](http://liw.fi/larch/ohad-btrees-shadowing-clones.pdf)

------
lumpypua
Absolutely awesome readme, comprehensive and covers an huge chunk of
background. I know more about in-memory tree data structures than when I
started. Beautiful API. This is how a data structure library should be done.

------
rurban
I'm very sceptical that in-mem B Trees can beat hashes, given their huge size
overhead and cache unfriendlyness

~~~
m_eiman
Quote the readme: "B-trees were originally invented in the 1970s as a data
structure for slow external storage devices. As such, they are strongly
optimized for locality of reference: they prefer to keep data in long
contiguous buffers and they keep pointer derefencing to a minimum.
(Dereferencing a pointer in a B-tree usually meant reading another block of
data from the spinning hard drive, which is a glacially slow device compared
to the main memory.)"

Sounds like it could be pretty cache friendly. Besides, a B-tree can be used
to implement a hash/dict/map.

~~~
rurban
I know b-trees. Still patricia trees or the optimized variant judy hashes are
more cache friendly, and non fucked-up hashes even more. For OrderedDict it
makes sense, but I would still consider judy or patricia better.

~~~
lorentey
Tries are awesome; but they're more specialized. So, as long as you have to
choose which one to implement first (and I do), B-trees provide better bang
for the buck.

