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:
Insertion into or removal from a large list (O(log n) vs. O(n))
Taking large slices of large lists (O(log n) vs O(n))
Making shallow copies of large lists (O(1) vs. O(n))
Changing large slices of large lists (O(log n + log k) vs. O(n + k))
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for blist-1.0.0-py2.6-linux-i686.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24d894aeb6d4ca8cab20d3f2c19955df742c6f75e2f5b9206a039b978d5ff7e8 |
|
MD5 | dab737a4d0df093322eada9b9a3c2b81 |
|
BLAKE2b-256 | f8ab8a1e4560db3ad8d291b04ad61537459cb792aaf9a3c4aded4593c437b4e9 |
Hashes for blist-1.0.0-py2.5-linux-i686.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31c54b993b8e7c872c0a3399e32aaf4bf99f221c68a74b39db11581bc72b6cf3 |
|
MD5 | 9fc95ff22ce9733e39145cac52847612 |
|
BLAKE2b-256 | 74b4608c3285f825bede805806c39d92ebc730ebe2d774a2b82ff87fc59f9aea |
Hashes for blist-1.0.0-py2.5-cygwin-1.5.25-i686.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3fcd8a4de90205c88172673fa66d0293ad2423c9d49713ea0906179649c8c35 |
|
MD5 | 45af4e5cabd3a2f4dabf8fda3064e47d |
|
BLAKE2b-256 | ee6a66784a859999faefed6d12ad69000c173227694a077acfd3c6a40bc10d14 |