A simple benchmark comparing Taichi and the default Python interpreter.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-03-12 19:20:40 -04:00
collatz.py Create collatz.py 2025-12-25 17:20:24 -05:00
LICENSE Initial commit 2025-12-25 16:39:24 -05:00
README.md Update README.md 2026-03-12 19:20:40 -04:00

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.