A somewhat fast C++ implementation of a prime sieve.
Not meant for production. This is just the result of some teenager with too much time on their hands.
The algorithm uses the segmented sieve of Eratosthenes with bucket sieve and a modulo 210 wheel.
Average time to find all primes below 1e9
.
Submit a pull request to add your benchmarks.
CPU | Single-Threaded | Multi-Threaded |
---|---|---|
Intel i5-8265U | 870 ms | 192 ms |
Intel i7-7700 | 787 ms | 159 ms |
Most compilers with C++17 will do.
g++ -std=c++17 -Ofast -pthread main.cpp -o prime-sieve
Please use Linux.
This program is licensed under the MIT License. See the LICENSE file for details.