Our preliminary test shows promising results. Building base62 with Cython results in great improvement in performance.
Test code
import random
import base62
for _ in range(1000000):
value = random.randint(0, 0xffffffff)
encoded = base62.encode(value)
assert base62.decode(encoded) == value
Test with native Python (3.5)
(pybase62) ➜ base62 git:(develop) ✗ time python test.py
python test.py 8.41s user 0.00s system 99% cpu 8.420 total
Test with Cython
(pybase62) ➜ base62 git:(develop) ✗ time python test.py
python test.py 6.63s user 0.00s system 99% cpu 6.636 total
That's approximately 21% of speed improvement. More thorough tests shall be conducted in the near future.
Our preliminary test shows promising results. Building
base62with Cython results in great improvement in performance.Test code
Test with native Python (3.5)
Test with Cython
That's approximately 21% of speed improvement. More thorough tests shall be conducted in the near future.