A drop-in replacement for the popular tqdm library, accelerated with C bindings
Project description
cqdm
A drop-in replacement for the popular tqdm library, accelerated with C bindings.
Usage
Install with pip install cqdm
.
Replace usages of tqdm.tqdm
with cqdm.cqdm
. This can be done
succinctly by changing your import
statement:
# was: from tqdm import tqdm
from cqdm import cqdm as tqdm
Performance
This library has about 1/3 the overhead of standard tqdm
:
This graph was generated by running performance.py
.
Impact
There are over 40 million monthly downloads of tqdm
. Let's
assume there are 40 million instances of tqdm
running
every day, each performing 10,000 iterations. This
many iterations uses around 0.023 seconds of overhead.
Across 40 million instances, this totals 92,000 seconds
or 9.58 days of overhead, per day. Assuming a relatively
cheap rate for CPU time on AWS, this equates to around $9
of compute time, per day globally.
Switching to cqdm
would reduce the cost of this overhead
by 2/3. That means, if everyone switched to using cqdm
,
we could save $6 in CPU time per day, globally.
Of course, this ignores the increased time for installs, compilation, etc., which is nearly an order of magnitude greater than the time saved...
Developing
To develop cqdm
locally:
- Create a fresh
venv
- Install
tqdm
withpip install tqdm
- Build the C-extension with
python setup.py build
- Install it with
python setup.py install
- Run the demo with
python demo.py
Performance
To generate performance graphs:
- Install
matplotlib
withpython3 -m pip install matplotlib
- If on linux, then it might be necessary to install a gui backend for
plt.show()
to function. Do so withsudo apt-get install python3-tk
- Generate the performance graph with
python performance.py
TODO
- Look into Python bytecode (compare with/without our "hack")
- Debugging/profiling C extensions
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for cqdm-1.0.3-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99717d3ed9e9251eac339f9c49cb67ff41cda0e50327323be37c6dfa8b53bb1d |
|
MD5 | 99e99fd06f8119eb01a442f51540a1f2 |
|
BLAKE2b-256 | 126563e0384c204d5addfec8f8d922d0995e78c22a902729e1262c11d69a7245 |
Hashes for cqdm-1.0.3-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 809b2e928dc702adee72cc4f24beb88786f624d10c4d2e72f44abac241ceaf9b |
|
MD5 | f3543f6eed446d1875306642d083f2c4 |
|
BLAKE2b-256 | 366937f58eccf23d3061947e0b4a54fe012fc2922ddd5c0a55db539653896489 |
Hashes for cqdm-1.0.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8f8cc84d083d31a58a6fc1ec9a0c4448fbc728042f6ef48e78828cef442f7c9 |
|
MD5 | d4739aac5c26f18aafb835d8d7920c89 |
|
BLAKE2b-256 | fec18a5de882ecfb8e3163593fb155509b211f4e02f4b2a23b12e1718ec7c8d5 |
Hashes for cqdm-1.0.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f308bc3077634869a034b835a8a7f9b1b24ee5222f0813dcceec05cb9e80943a |
|
MD5 | 97294f30a1007e50576456f0b31d4972 |
|
BLAKE2b-256 | 5221888ebe0448c510ddf715d765daeed6bd88748db4b1f54de82444510b30f2 |
Hashes for cqdm-1.0.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3dc34f3ad0af6af6e93ffd3d985bf096b774021e735cc9e39758841907f835c7 |
|
MD5 | 0a84456a071182827d5197b524fd2cee |
|
BLAKE2b-256 | a8c437e5927f82c60aa041d50ad4b6df938dd70acf124b610b7b8acd8b6b673c |
Hashes for cqdm-1.0.3-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c7cde23028f0cdf58121745fdb9761f243c72e9d3758238e8fa9fb456871e59 |
|
MD5 | 9ec179c393429e5e064b14a777f8b487 |
|
BLAKE2b-256 | 8b9fb4cb4bcada2bbc22265f9d2cb9f9ae47a32c8c4d5e9a046683c70880d527 |
Hashes for cqdm-1.0.3-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17ef5e440a231f49c571c047f780dcfc1f73311c2dfac161ceeca3975fdd8942 |
|
MD5 | 2dc9a3ab3ec3760ba03ccd16ac6997c2 |
|
BLAKE2b-256 | 6eb2db8c9cb79cdaaf70e473455644dee64cd99aefd04756199bf6f976bc3da3 |