- Python 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| collatz.py | ||
| LICENSE | ||
| README.md | ||
collatzmark
A simple benchmark comparing Taichi and stock Python when computing the number of steps in the Collatz conjecture for a given number.
On my machine (AMD Ryzen 9 3950X 16-Core Processor, Ubuntu 25.04, NVIDIA 5060 TI), the results look something like this:
| Method | Average time* |
|---|---|
| Unoptimized (CPU, single-threaded) | 0.719878 seconds |
| Optimized (CPU, multi-threaded) | 0.002016 seconds |
| Optimized (GPU, multi-threaded) | 0.000037 seconds |
*This is the time required to verify the Collatz conjecture from 1 through 100,000, averaged over 100 attempts.
As the table shows, the GPU version was 5348% faster than the Taichi-optimized CPU code, and 1,945,516% faster than the unoptimized CPU code.
Dependencies
Collatzmark depends upon taichi and tqdm; you can install them with pip3 install taichi tqdm.
A note about manmade code
The owner of this project believes in good faith that it complies with The Manmade Software Declaration 1.0. Contributors are encouraged to follow the guidelines described at the aforementioned link when proposing any code changes, and patches that appear to violate those rules may be rejected at any time.