Assets 5

primesieve-7.1 runs up to 30% faster on Intel Skylake-X CPUs!

The default sieve size is now (L2 cache size / 2). Using a sieve size that is slightly smaller than the L2 cache size allows other important data structures to also fit into the L2 cache. This reduces the number of L2 cache misses which improves performance on CPUs with slow L3 caches. primesieve-7.1 will also run slightly faster (< 3%) on most other Intel CPUs.

  • api.cpp: Default sieve size = (L2 cache size / 2).
  • CpuInfo.cpp: Improved CPU info detection.
  • Erat.cpp: Lazy PreSieve initialization.
  • EratSmall.cpp: Fix too large sieve size.
  • help.cpp: Update help menu (--help).
  • ParallelSieve.cpp: Improved load balancing.
  • --cpu-info: New option, prints CPU information.
  • Rename kilobytes to KiB because it is more accurate.
  • Faster Windows binary built using clang-cl.

@kimwalisch kimwalisch released this Apr 25, 2018 · 47 commits to master since this release

Assets 5

Performance improvements

The next_prime() function of primesieve::iterator has been improved.

Up until now libprimesieve sieved an interval of size sqrt(n) and stored the primes inside that interval in an array. next_prime() then iterated over the primes in the array. Once there were no more primes available in the array libprimesieve regenerated new primes which incurred an initialization overhead of sqrt(n) * log log sqrt(n) operations to recompute the sieving primes. This initialization overhead has been removed in primesieve-7.0 which gives a 2x speed improvement for next_prime() when iterating over primes ≥ 10^15.

next_prime() benchmark

Start primesieve 7.0 primesieve 6.4 primegen 0.97 Math-Prime-Util-GMP
0 2.66 sec 3.42 sec 7.50 sec 15.26 sec
1010 2.82 sec 3.53 sec 7.36 sec 17.98 sec
1011 3.19 sec 3.89 sec 7.31 sec 27.05 sec
1012 3.46 sec 4.51 sec 7.70 sec 51.59 sec
1013 3.97 sec 5.63 sec 10.06 sec 112.59 sec
1014 4.46 sec 8.41 sec 17.60 sec 285.31 sec
1015 4.97 sec 10.70 sec 41.45 sec 813.77 sec
1016 5.56 sec 11.29 sec 122.44 sec 2,439.96 sec
1017 6.29 sec 11.69 sec 508.56 sec 9,115.23 sec
1018 7.61 sec 12.24 sec 2,986.10 sec NaN

primesieve, primegen and Math-Prime-Util are the fastest open source prime number generation libraries. The benchmark above has been run on an Intel Core-i7 6700 CPU and all libraries have been compiled using GCC 8 with -O3. At each start offset the benchmark programs iterated over the primes inside an interval of size 10^10 using next_prime().

API Changes

None, the API is backwards compatible with primesieve-6.x.

Breaking ABI Changes

New variables have been added to the C++ primesieve::iterator class and the C primesieve_iterator struct. Hence applications that link against the shared libprimesieve need to be recompiled. Users that have written primesieve bindings for other programming languages are affected by these ABI changes and need to update their code.

Pre-release
Pre-release

@kimwalisch kimwalisch released this Feb 16, 2018 · 181 commits to master since this release

Assets 2

See the ChangeLog for what's new.

Pre-release

@kimwalisch kimwalisch released this Jan 29, 2018 · 206 commits to master since this release

Assets 2

See the ChangeLog for what's new.

@kimwalisch kimwalisch released this Nov 18, 2017 · 225 commits to master since this release

Assets 2

See the ChangeLog for what's new.

Pre-release
Pre-release

@kimwalisch kimwalisch released this Nov 12, 2017 · 225 commits to master since this release

Assets 2

See the ChangeLog for what's new.