blist icon indicating copy to clipboard operation
blist copied to clipboard

Performance test, blist slower?

Open apiszcz opened this issue 4 years ago • 2 comments

Python 3.7, Windows 10/64, blist 1.3.6

Multiple runs each end up with the similar timing

image

apiszcz avatar Aug 26 '20 09:08 apiszcz

That should be expected. blist optimizes for arbitrary insertion, slicing, and indexing. Both Python and blist has O(1) appending and Python's list.append comparatively has very little to do because it doesn't have to maintain the blist's tree structure. So the overhead of that additional maintenance is what you're seeing here.

elihunter173 avatar Oct 14 '20 03:10 elihunter173

The documentation states the underlying implementation uses a regular order statistic B+-tree. That means appending involves splitting the max node in the tree whenever it runs full and copying half of the contents to a new max node. I wonder what the cost is, when you remove the "str()" calls and insert integers instead. Because copying strings is usually more expensive that copying integers. Just my 2 cents.

frankencode avatar Apr 06 '23 01:04 frankencode