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.16.tar.gz (104.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

blist-0.9.16-py2.6-linux-i686.egg (92.9 kB view details)

Uploaded Egg

blist-0.9.16-py2.5-linux-i686.egg (92.7 kB view details)

Uploaded Egg

blist-0.9.16-py2.5-cygwin-1.5.25-i686.egg (94.5 kB view details)

Uploaded Egg

File details

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

File metadata

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

File hashes

Hashes for blist-0.9.16.tar.gz
Algorithm Hash digest
SHA256 1a3187ca9d45fcfa99d14d1219cbda1fec85fd607d34327aee2f360b9a788123
MD5 81e6c71bb283de529acbc11492a09da5
BLAKE2b-256 a91f67f0ac4432870a36a05b98ba18386d2dd125973fd7335ba71a4b959f306e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blist-0.9.16-py2.6-linux-i686.egg
Algorithm Hash digest
SHA256 ddc01abcdea82fec4b4fddcb579146db1b57c86314cacc68a51993476472ace9
MD5 abfd391c5796d23ce619d39821222a1b
BLAKE2b-256 fe3f085efb8cd4200055c5cf33003fd37af2d61e1cfb402423e363fe07130296

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blist-0.9.16-py2.5-linux-i686.egg
Algorithm Hash digest
SHA256 7250e1131add5368a4f4b609102ab4502813236195caa60eb4110e38c62eeda7
MD5 f3cdb734b057efe00984984bf1af4f42
BLAKE2b-256 8f764cce2bc27906e773a1f859e4417113670adf00780494263ea5b592d846f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blist-0.9.16-py2.5-cygwin-1.5.25-i686.egg
Algorithm Hash digest
SHA256 af3dbe189e32b8c6af99bfe37581cbe5ffa4a1f13b4e5244d2c4cf020bce9c54
MD5 6322c6ccef4460008107f351777419b5
BLAKE2b-256 67e0e0221afe00eec5251f0e19fe55312cd2bfb3ae03fbf1b0af3f20c4d6af4b

See more details on using hashes here.

Supported by

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