Hacker News new | ask | show | jobs
by raccoonone 867 days ago
I wrote redb (https://github.com/cberner/redb) using mmap, initially. However, I later removed it and switched to read()/write() with my own user space cache. I'm sure it's not as good as the OS page cache, but the difference was only 1.2-1.5x performance on the benchmarks I cared about, and the cache is less than 500 lines of code. Also, by removing mmap() I was able to remove all the unsafe code associated with it, so now redb is memory-safe.
1 comments

500 lines of code is still 500 lines of added complexity. For LMDB that'd be a 7% increase in LOCs, which would also introduce the need for manual cache configuration and tuning (further increasing complexity for the end user) and a 50% performance loss? Doesn't seem like a good tradeoff to me.

But at least you thought about the decision. Nice benchmark, by the way. https://mastodon.social/@hyc/111887577620902329