Skip to main content

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

Project description

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

Earlier versions of BList were also slower for large lists that never change length, but this is no longer true as of version 0.9.6, which features amortized worst-case O(1) getitem and setitem operations.

With that disclaimer out of the way, 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”. For small lists, BLists and the built-in list have very similar performance.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blist-0.9.15.tar.gz (103.9 kB view details)

Uploaded Source

Built Distributions

blist-0.9.15.win32-py3.0.exe (223.0 kB view details)

Uploaded Source

blist-0.9.15.win32-py2.6.exe (93.9 kB view details)

Uploaded Source

blist-0.9.15-py2.6-win32.egg (26.0 kB view details)

Uploaded Egg

blist-0.9.15-py2.6-linux-i686.egg (91.3 kB view details)

Uploaded Egg

blist-0.9.15-py2.5-linux-i686.egg (91.1 kB view details)

Uploaded Egg

blist-0.9.15-py2.5-cygwin-1.5.25-i686.egg (93.3 kB view details)

Uploaded Egg

File details

Details for the file blist-0.9.15.tar.gz.

File metadata

  • Download URL: blist-0.9.15.tar.gz
  • Upload date:
  • Size: 103.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for blist-0.9.15.tar.gz
Algorithm Hash digest
SHA256 4ccf8e98fa1dd03dd44db2e86290a4ecc1c01b31266a0627776f7565b798bf68
MD5 da47d1d0a4f2d63a128f63becf4c1081
BLAKE2b-256 59f1073f7714df096bfc98ce52a28271a8afc0957a0af7c30c79c4b374461413

See more details on using hashes here.

File details

Details for the file blist-0.9.15.win32-py3.0.exe.

File metadata

File hashes

Hashes for blist-0.9.15.win32-py3.0.exe
Algorithm Hash digest
SHA256 f5465f8cec0bc4b4e18f44cd219ab53bef7e66e9c763901d0de2e69fcd979b14
MD5 03d6f620be8cfa83fe3a818973f5dd92
BLAKE2b-256 904856cfb4ac1cd9e082f58aa4fe24ef5b212f13e17af61825f239c58730cd20

See more details on using hashes here.

File details

Details for the file blist-0.9.15.win32-py2.6.exe.

File metadata

File hashes

Hashes for blist-0.9.15.win32-py2.6.exe
Algorithm Hash digest
SHA256 e671bec603628787dafd333b9c9999708ad3d1a97d9af79b2f435de310225917
MD5 6eb2f3440b3a3c6ad8cd564081714cb5
BLAKE2b-256 eeaf2cad037e2ee37f32627f93b7e13337373794a5b273c1834cbf744a05b81e

See more details on using hashes here.

File details

Details for the file blist-0.9.15-py2.6-win32.egg.

File metadata

File hashes

Hashes for blist-0.9.15-py2.6-win32.egg
Algorithm Hash digest
SHA256 e7a374aa5f29ca5b3c79cea176e5e924fbdb09f5ec8491a672e1e057a7c7dbb9
MD5 48241402ad2f65da8d97272e49466be6
BLAKE2b-256 c11bdcee749329f77bd364908a251dbd7c5b36ef88aca85a03eb76cf11951382

See more details on using hashes here.

File details

Details for the file blist-0.9.15-py2.6-linux-i686.egg.

File metadata

File hashes

Hashes for blist-0.9.15-py2.6-linux-i686.egg
Algorithm Hash digest
SHA256 1c4439a16c13e277fda66ea7ed21f87426789764a406f882008fba9b4fd56b8e
MD5 4b7c52d4a8c4dc87cddc6882b18a40ff
BLAKE2b-256 08c115462683bba7cb8f41261fb04826aa45598ca506a98bd728be3906d51b9e

See more details on using hashes here.

File details

Details for the file blist-0.9.15-py2.5-linux-i686.egg.

File metadata

File hashes

Hashes for blist-0.9.15-py2.5-linux-i686.egg
Algorithm Hash digest
SHA256 17a88ff683237c57ec38ada2a085dc3784fcaf06bddc0d58ac8ecf9ea60cb4b9
MD5 9037e93ef41b00c56141e8ffbdf289d2
BLAKE2b-256 84e662ef951be66f7022fb5dafd6d6c4e1c223870a32089c71b31eecaeecb91c

See more details on using hashes here.

File details

Details for the file blist-0.9.15-py2.5-cygwin-1.5.25-i686.egg.

File metadata

File hashes

Hashes for blist-0.9.15-py2.5-cygwin-1.5.25-i686.egg
Algorithm Hash digest
SHA256 cfe7372bc697415ec5322072a02595409b7db8471ac4190bfeae351123b72925
MD5 9b758ce2a4f79ba53fd84ed18511ab2d
BLAKE2b-256 27140a5feb4e095b4d059306667da9d1cd4cfae9640ef31ce4a85ad3b56aa338

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page