Re: A very slow program

Paul <[email protected]> Thu, 3 Oct 2024 17:25:14 -0400
Newsgroups alt.comp.lang.c,comp.lang.c
Organization A noiseless patient Spider
Message-ID <[email protected]>
On Wed, 10/2/2024 8:44 AM, Bonita Montero wrote:
> Ive developed a Sieve of Erastosthenes in C++20 with an unbeaten
> performance. With this code I get all primes <= 2 ^ 32 in 140ms
> on my AMD 7950X 16-core Zen4-system.

Why not measure against the programs provided in a Linux distro ?

$ time primesieve 1e6
Sieve size = 256 KiB
Threads = 1
100%
Seconds: 0.000
Primes: 78498

real    0m0.002s   <=== Without printing the numbers, is pretty fast
user    0m0.000s
sys     0m0.000s

$ time primesieve 1e6 --print > NUL

real    0m0.009s   <=== Without Terminal to slow I/O, is in the Unix ballpark
user    0m0.005s
sys     0m0.000s

$ time primesieve 4294967295
Sieve size = 256 KiB
Threads = 16             <=== 5700G Zen3  (8C 16T), stock speed, execution under WSL2
100%
Seconds: 0.072
Primes: 203280221

real    0m0.073s
user    0m0.869s
sys     0m0.009s

   Paul