// the find
zcbenz/BPlusTree
B+ tree implementation which stores data in file
A file-backed B+ tree in C++, written around 2012 by Zhao Cheng (zcbenz, the Electron co-creator). Keys, values, and node sizes are fixed at compile time — you edit a header, recompile, and get a small self-contained library that can handle datasets larger than RAM. It's a learning artifact and reference implementation, not a production storage engine.
The implementation is genuinely tiny — bpt.h and bpt.cc together are probably under 500 lines, which makes the whole thing readable in an afternoon. Test coverage is unusually good for a solo side project: the test suite is longer than the implementation itself, which is a discipline most open-source authors skip. The CLI and dump_numbers utilities let you poke at a real database file without writing any code, which is useful for understanding what the tree is actually doing on disk. The author clearly knows the domain — Cheng went on to build Electron, so this isn't a student project from someone guessing at data structures.
Fixed key/value sizes are a hard constraint, not a trade-off you can work around at runtime — changing them means recompiling, which rules this out for anything that needs to store variable-length data. There's no concurrency support: no locks, no transaction semantics, no WAL. Last commit is from 2024 but the code itself dates to 2012 and hasn't evolved to match modern C++ or add features like iterators or batch operations. If you actually need a file-backed B+ tree in production, you'd reach for LMDB or RocksDB; this repo's value is as a clear, readable reference, not as a dependency.