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

Uploaded Source

Built Distributions

blist-0.9.14.win32-py3.0.exe (222.3 kB view details)

Uploaded Source

blist-0.9.14.win32-py2.6.exe (93.3 kB view details)

Uploaded Source

blist-0.9.14-py2.6-linux-i686.egg (91.4 kB view details)

Uploaded Egg

blist-0.9.14-py2.5-linux-i686.egg (90.9 kB view details)

Uploaded Egg

blist-0.9.14-py2.5-cygwin-1.5.25-i686.egg (92.3 kB view details)

Uploaded Egg

File details

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

File metadata

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

File hashes

Hashes for blist-0.9.14.tar.gz
Algorithm Hash digest
SHA256 1b497407516eb1c5beb83b014dd41fd5e5292b2d7121abf83661fcac4f038788
MD5 f345b6894afb14c48c15d0f29b34234e
BLAKE2b-256 ba9aaa14333f5fafde3a642da05c8a98c8696de36421eb29d101bce672c25225

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blist-0.9.14.win32-py3.0.exe
Algorithm Hash digest
SHA256 e962da8c0a88316d5df776b61f568d4ab4560e6d9ca46e439dc8d22ca5d47bfe
MD5 3fb2feb6b2350de59e4eb417e24cd319
BLAKE2b-256 e9f2c6543e2c188d3fdee14f69c481d38363fffb5a9cd5616cefff5e06914bfd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blist-0.9.14.win32-py2.6.exe
Algorithm Hash digest
SHA256 731b6da83cd5fb8055561a016b87d526c9c61a8a7a45a8a9646f389169dfa501
MD5 5569bdc3666388ed5a7f3fc1c064ca86
BLAKE2b-256 54bef5ff83d7fb8caab47e7a2ee737d17baa92d121b4deeea645b591763759c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blist-0.9.14-py2.6-linux-i686.egg
Algorithm Hash digest
SHA256 3f9b40a2550aaabfacfa2ef673361885616474a1c8f0859e54b82950c7e6c714
MD5 43b07eace21c70bbb8596ebff2924f8c
BLAKE2b-256 e8f397699b26faa1679210dc977ec935dd3c8b4e940d35c3a606c19f0e3d3c6c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blist-0.9.14-py2.5-linux-i686.egg
Algorithm Hash digest
SHA256 36f602762c0a07c1d92bbbb9c0926eb11ad1e60a6d7774daa98d7780136822ac
MD5 5c86e7bb1b5594e95d498e139f5db544
BLAKE2b-256 0fea52bf870ef85b38b5ac29b95a3569e99c4d5b64fcacd77ba90c037b475f11

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blist-0.9.14-py2.5-cygwin-1.5.25-i686.egg
Algorithm Hash digest
SHA256 abb63f89d19a0a00b3712b3f3009b8b443116d9d3b64b35fde6a7283f0fc3b20
MD5 7e11efea5e2344d770b5c56c5a716b74
BLAKE2b-256 8eb691f0ffc005c30d72d49f33e02637c37858d9577441b515200446db61c136

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