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.

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.

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

Uploaded Source

Built Distributions

blist-1.0.0-py2.6-linux-i686.egg (94.3 kB view details)

Uploaded Egg

blist-1.0.0-py2.5-linux-i686.egg (93.9 kB view details)

Uploaded Egg

blist-1.0.0-py2.5-cygwin-1.5.25-i686.egg (94.8 kB view details)

Uploaded Egg

File details

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

File metadata

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

File hashes

Hashes for blist-1.0.0.tar.gz
Algorithm Hash digest
SHA256 782c9afe8c0b9ddd837ab901e1170eda6d74f30cb10afe6dc9a323f340d5cecb
MD5 c71d78c70e4f786e216980a031280b26
BLAKE2b-256 19eab62b3061eca2c0131a58ac2abd2abcbf2aa35fb932e759322d4cf35c3575

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blist-1.0.0-py2.6-linux-i686.egg
Algorithm Hash digest
SHA256 24d894aeb6d4ca8cab20d3f2c19955df742c6f75e2f5b9206a039b978d5ff7e8
MD5 dab737a4d0df093322eada9b9a3c2b81
BLAKE2b-256 f8ab8a1e4560db3ad8d291b04ad61537459cb792aaf9a3c4aded4593c437b4e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blist-1.0.0-py2.5-linux-i686.egg
Algorithm Hash digest
SHA256 31c54b993b8e7c872c0a3399e32aaf4bf99f221c68a74b39db11581bc72b6cf3
MD5 9fc95ff22ce9733e39145cac52847612
BLAKE2b-256 74b4608c3285f825bede805806c39d92ebc730ebe2d774a2b82ff87fc59f9aea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blist-1.0.0-py2.5-cygwin-1.5.25-i686.egg
Algorithm Hash digest
SHA256 a3fcd8a4de90205c88172673fa66d0293ad2423c9d49713ea0906179649c8c35
MD5 45af4e5cabd3a2f4dabf8fda3064e47d
BLAKE2b-256 ee6a66784a859999faefed6d12ad69000c173227694a077acfd3c6a40bc10d14

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