Simple C program that calculates all prime numbers up to an upper bound. Use it to measure integer calculation speeds on your CPU or play around. Can load multiple cores through multiple threads.
You can build with:
make
# If you don't have gcc:
make clang
Or, if you don't have Make:
gcc benchmark.c -o benchmark
# If you don't have gcc:
clang benchmark.c -o benchmark
Edit the benchmark.c
file at line 6:
#define UPPER_LIMIT 100000
Replace 100000
with your upper limit of choice.
Because the program uses an int as counter the max upper limit is 2^31 - 1 (~2.1 billion).
You can also change the thread count on line 7:
#define THREADS 8
Replace 8 with the number of threads you want.
Have fun!