r/TrueOpenSource • • 3d ago

Contribution: Open Data & Research learned_index_lab v0.4.2: Comparing PGM-Index, Multilevel PGM, Eytzinger, and BTreeMap on synthetic and SOSD workloads

I haven't really posted about my project, learned_index_lab, since v0.2, and it has evolved quite a bit since then up to the latest v0.4.2 release. What started as a simple single-level Piecewise Geometric Model (PGM) index has grown into a more complete lab for comparing learned indexes against BTreeMap, flat slice binary search, and Eytzinger layouts.

Since v0.3.0, I added the cache-conscious Eytzinger baseline alongside isolated single-threaded benchmarking. In v0.4.0, I introduced MultilevelPgmIndex, a recursive hierarchical index for larger datasets, integrated real-world workloads from the SOSD benchmark suite, and added a batch ingestion and streaming rebuild benchmark against in-place BTreeMap mutations.

I also got some feedback from people hoping I would turn this into a standalone library anyone can use as a dependency. While that isn't the case yet, I think extracting an independent library for it should be possible, and if there is demand for it I will probably do it, as I think it's a shame that this kind of structure mostly stays limited to big companies.

Testing against real-world data made the trade-offs much clearer. PGM performs best on smooth distributions while keeping metadata very small, whereas BTreeMap remains stronger on irregular or fragmented distributions, and Eytzinger stays consistently fast without approximation error. Here is a quick summary of the consolidated average lookup latency measured across all six workloads:

BTreeMap 214.2 ns

Flat Slice 191.4 ns

Eytzinger 156.0 ns

PGM-Index 140.5 ns

Multilevel PGM 180.7 ns

For v0.4.2, I also organized all the documentation into an mdBook. You can find more details and the full source code on GitHub at https://github.com/gilnett/learned_index_lab.

How it was built: AI-assisted

Builds on: The PGM-index paper (Ferragina & Vinciguerra, 2020), the Eytzinger layout (Khuong & Morin, 2017), and the SOSD benchmark suite.

What mine adds: An independent benchmark lab built to compare where different indexing structures learned indexes, BTreeMap, binary search, and Eytzinger etc actually perform across synthetic and real-world workloads

1 Upvotes

1 comment sorted by

•

u/trueopensource-bot 🤖 Robot 3d ago

About this project · gilnett/learned_index_lab
⭐ 165 stars · 🍴 5 forks · 👥 2 contributors · 📄 Apache-2.0
History: started Oct 2026 · last code change today · 85 commits on 12 different days in the last 90 days
Releases: latest v0.4.2 (today) · 7 releases in the last 90 days
How it was built: the author says people wrote this, with AI helping along the way. (More on our labels: rule 4.)

Facts from GitHub when this was posted. I'm a bot.