News for hackers. Stuff that matters.
Re:Show HN: On-disk B+ tree for Python 3 by laurencerowe on Sunday January 21, 2018 @05:38PM (#16200473)
ZODB has a mature B+Tree implementation for on disk use in the BTrees package. https://pypi.python.org/pypi/BTrees
Re:Show HN: On-disk B+ tree for Python 3 by dimatura on Sunday January 21, 2018 @03:01PM (#16199678)
Nice, I'm a big user of various data stores for scientific work. How does this compare to LMDB (http://www.lmdb.tech/doc/), which uses B-trees (and has a Python interface)?
Re:Show HN: On-disk B+ tree for Python 3 by nicolaslem on Sunday January 21, 2018 @03:13PM (#16199734)
I haven't done any benchmark yet but I expect my implementation to be at least an order of magnitude slower.

I've found my implementation to be CPU intensive: creating Python objects from the raw pages is expensive. That's why bulk inserts and iterations are much faster than insert/get in a loop.

Re:Show HN: On-disk B+ tree for Python 3 by sprt on Sunday January 21, 2018 @06:42PM (#16200787)
The code looks very clean. Uses type annotations too. Wish there were more comments though.
Re:Show HN: On-disk B+ tree for Python 3 by nicolaslem on Monday January 22, 2018 @02:50PM (#16207306)
Thank you! I found that type annotations make code easier to read so I tend to write less comments. But I'll make an effort.
Re:Show HN: On-disk B+ tree for Python 3 by erezsh on Monday January 22, 2018 @03:35AM (#16202842)
How does this perform compared to sqlite3?

And and can you use keys that aren't builtin values?

Re:Show HN: On-disk B+ tree for Python 3 by nicolaslem on Monday January 22, 2018 @02:52PM (#16207323)
It is possible to use your own key if it has a natural order and you write your own simple serializer: https://github.com/NicolasLM/bplustree/blob/master/bplustree...
Re:Show HN: On-disk B+ tree for Python 3 by antman on Sunday January 21, 2018 @02:36PM (#16199546)
Cannot delete items yet
Re:Show HN: On-disk B+ tree for Python 3 by nicolaslem on Sunday January 21, 2018 @02:58PM (#16199660)
Yes, it's a work in progress, see the `remove` branch.
Re:Show HN: On-disk B+ tree for Python 3 by IvyMike on Sunday January 21, 2018 @03:02PM (#16199686)
That is a very dangerous name for a branch.
Re:Show HN: On-disk B+ tree for Python 3 by liopleurodon on Sunday January 21, 2018 @03:04PM (#16199698)
lol, truth
Re:Show HN: On-disk B+ tree for Python 3 by coleifer on Sunday January 21, 2018 @10:16PM (#16201626)
Why is this not mentioned very clearly in the README? Seems like willful misrepresentation.

You might also mention that, if replacing large values that use overflow pages, the file has the potential to grow without bounds as it looks like overflow pages are not collected?

Re:Show HN: On-disk B+ tree for Python 3 by j_s on Sunday January 21, 2018 @10:07PM (#16201583)
Are there any production data stores recommended for low memory usage? What should I use to stream data to disk and back with minimal overhead, preferably with indexed lookups?
Re:Show HN: On-disk B+ tree for Python 3 by bufferoverflow on Monday January 22, 2018 @02:18AM (#16202489)
An SSD with the highest random-read/write IOPS you can afford. Something like this:

https://www.computerworld.com/article/2987956/solid-state-dr...

Or FusionIO ioDrive2 Duo, which is above 900K IOPS for both reads and writes.

Re:Show HN: On-disk B+ tree for Python 3 by zerokernel on Sunday January 21, 2018 @05:36PM (#16200461)
Re:Show HN: On-disk B+ tree for Python 3 by evolighting on Sunday January 21, 2018 @11:23PM (#16201907)
what about using a DB? Is there any really simple database for the same purpose?
Re:Show HN: On-disk B+ tree for Python 3 by coleifer on Sunday January 21, 2018 @10:01PM (#16201565)
This is pretty cool. As I was reading the code I really wished for an explanation or simple ASCII diagram of the serialization formats for the various node/record types, as well as for the frames/wal format. Given that the poster is the author of the project, I hope you'll consider filling in these kinds of details, as they'd presumably be of interest to the people you're "Show"-ing this to.
Re:Show HN: On-disk B+ tree for Python 3 by nicolaslem on Monday January 22, 2018 @02:58PM (#16207363)
Thank you. I know what you mean, I'm not happy with how the serialization is done right now, it's too complicated.

Maybe someone on HN knows a Python serialization library beyond pickle that would allow to describe how the data is laid out and take care of the rest. It looks like struct is not flexible enough for this usage.

Re:Show HN: On-disk B+ tree for Python 3 by coleifer on Sunday January 21, 2018 @06:35PM (#16200764)
Thanks for sharing, I've been interested in finding pure python implementations of storage engines. Another one I came across is whoosh: https://bitbucket.org/mchaput/whoosh/src/a16ebacb47191afaf2d...
Re:Show HN: On-disk B+ tree for Python 3 by shalabhc on Sunday January 21, 2018 @07:35PM (#16200988)
Check out zodb and durus.
Re:Show HN: On-disk B+ tree for Python 3 by halayli on Sunday January 21, 2018 @03:01PM (#16199682)
What's wrong with LMDB?