skip to navigation
skip to content

blist 1.0.1

a list-like type with better asymptotic performance and similar performance on small lists

Latest Version: 1.0.2

The BList is a type that looks, acts, and quacks like a Python list, but has better performance for for modifying large lists.

For small lists (fewer than 128 elements), BLists and the built-in list have very similar performance, although BLists are memory inefficient if you need to create a larger number of small lists.

Here are some of the use cases where the BLists is dramatically faster than the built-in list:

  1. Insertion into or removal from a large list (O(log n) vs. O(n))
  2. Taking large slices of large lists (O(log n) vs O(n))
  3. Making shallow copies of large lists (O(1) vs. O(n))
  4. Changing large slices of large lists (O(log n + log k) vs. O(n + k))
  5. Multiplying a list to make a large, sparse list (O(log k) vs. O(kn))

You've probably noticed that we keep referring to "large lists".

So you can see the performance of the BList in more detail, several performance graphs available at the following link: http://stutzbachenterprises.com/blist/

Example usage:

>>> from blist import *
>>> x = blist([0])             # x is a BList with one element
>>> x *= 2**29                 # x is a BList with > 500 million elements
>>> x.append(5)                # append to x
>>> y = x[4:-234234]           # Take a 500 million element slice from x
>>> del x[3:1024]              # Delete a few thousand elements from x

For comparison, on most systems the built-in list just raises MemoryError and calls it a day.

File Type Py Version Uploaded on Size # downloads
blist-1.0.1.win32-py3.1.exe (md5, pgp) MS Windows installer 3.1 2009-07-23 01:27:10.734649 217KB 45
blist-1.0.1-py2.5-cygwin-1.5.25-i686.egg (md5, pgp) Python Egg 2.5 2009-04-03 22:47:26.901771 95KB 165
blist-1.0.1.win32-py3.0.exe (md5, pgp) MS Windows installer 3.0 2009-04-03 22:49:23.361979 217KB 91
blist-1.0.1.tar.gz (md5, pgp) Source 2009-04-03 22:47:20.386726 92KB 207
blist-1.0.1-py2.6-win32.egg (md5, pgp) Python Egg 2.6 2009-04-03 22:50:24.977262 25KB 163
blist-1.0.1-py2.5-linux-i686.egg (md5, pgp) Python Egg 2.5 2009-04-03 22:53:23.880975 91KB 181
blist-1.0.1.win32-py2.6.exe (md5, pgp) MS Windows installer 2.6 2009-04-03 22:49:01.905236 91KB 100
blist-1.0.1-py2.6-linux-i686.egg (md5, pgp) Python Egg 2.6 2009-04-03 22:53:42.074296 91KB 170

Log in to rate this package.