Debian Codegraph @

ChangeLog

raw
1 Changes in version 12.15, 17/07/2026
2 ====================================
3
4 * Fix LLVM/Clang -Wunused-template warning.
5 * CpuInfo.cpp: Use primesieve::Vector instead of std::vector.
6 * macros.hpp: Add INDETERMINATE macro to prevent memset zero initialization of large stack arrays.
7 * nthPrime.cpp: Fix undefined behavior.
8 * util.hpp: Fix undefined behavior in littleendian_cast<T>().
9 * PrimeGenerator_x86_avx512.hpp: Fix undefined behavior.
10 * CountPrintPrimes.cpp: Fix undefined behavior.
11 * popcount.hpp: Fix undefined behavior.
12 * PreSieve_arm_sve.hpp: Use __attribute__((target("+sve"))) instead of
13 target("arch=armv8-a+sve") for the ARM SVE multiarch runtime dispatch.
14 The latter reset the CPU architecture baseline to armv8-a.
15 * multiarch_sve_arm.cmake: Update the ARM SVE compiler support check
16 to match.
17 * CMakeLists.txt: Disable building the shared libprimesieve on
18 Emscripten (WebAssembly) so that the primesieve binary is linked
19 statically. Emscripten now builds shared libraries as side modules,
20 which broke static linking of the binary and the WebAssembly CI build.
21
22 Changes in version 12.14, 08/05/2026
23 ====================================
24
25 * ParallelSieve.cpp: Prevent CPU false sharing.
26 * PrimeSieveClass.hpp: Prevent CPU false sharing.
27 * malloc_vector.h: Fix undefined behavior.
28 * calculator.hpp: Fix std::tolower undefined behavior.
29 * CpuInfo.cpp: Fix std::isdigit undefined behavior.
30 * CmdOptions.cpp: Fix 64-bit integer overflow in optionTimeout().
31 * PrimeSieveClass.cpp: Reduce mutex contention.
32 * iterator-c.cpp: Fix use after free in primesieve_free_iterator().
33 * config.hpp: Add MAX_CACHE_LINE_SIZE.
34 * macros.hpp: Add MAYBE_UNUSED.
35 * Vector.hpp: Improve Vector exception safety.
36 * GitHub Actions CI: Fix node 20 deprecation warning.
37 * CMakeLists.txt: On Windows rename static library to primesieve_static.lib #183.
38 * CMakeLists.txt: Remove WITH_MSVC_CRT_STATIC option.
39
40 Changes in version 12.13, 01/02/2026
41 ====================================
42
43 * Fix missing version in .pc file #176.
44
45 Changes in version 12.12, 09/01/2026
46 ====================================
47
48 * CMakeLists.txt: Fix CMAKE_PROJECT_VERSION not defined.
49 * doc/Doxyfile.in: REVERSE workaround for Doxygen/LaTeX broken tables #172.
50 * Automated building Windows binaries using GitHub Actions CI.
51 * build_clang_x64.ps1: New Clang Windows x64 build script.
52 * build_clang_arm64.ps1: New Clang Windows ARM64 build script.
53
54 Changes in version 12.11, 12/12/2025
55 ====================================
56
57 * calculator.hpp: Update to version 2.0 with improved error handling.
58 This version detects most integer overflows and underflows.
59 * test/calculator.cpp: Add much more tests for calculator.hpp.
60 * PreSieve.cpp: Simplify SIMD runtime dispatching.
61 * CountPrintPrimes.cpp: Faster printing of primes to stdout.
62 * CmdOptions.cpp: Prevent multiple different --print options.
63 * CMakeLists.txt: Set CMAKE_VISIBILITY_INLINES_HIDDEN=ON by default.
64 * BUILD.md: Update MSVC build instructions.
65
66 Changes in version 12.10, 03/11/2025
67 ====================================
68
69 * src/MemoryPool.cpp: Fix undefined behavior in Bucket allocation.
70 * build_mingw64_arm64.sh: Enable ARM SVE for Mingw-w64 on ARM64.
71 * test/CMakeLists.txt: Improve Windows libprimesieve.dll support.
72 * examples/c/CMakeLists.txt: Improve Windows libprimesieve.dll support.
73 * examples/cpp/CMakeLists.txt: Improve Windows libprimesieve.dll support.
74 * ci.yml: Add WebAssembly/Emscripten test.
75 * BUILD.md: Add WebAssembly/Emscripten build instructions.
76
77 Changes in version 12.9, 14/05/2025
78 ===================================
79
80 * CMakeLists.txt: Speed up build by removing compile dependencies.
81 * Move private header files from /include to /src.
82 * src/CMakeLists.txt: Update for private header files in /src.
83 * test/CMakeLists.txt: Update for private header files in /src.
84 * Vector.hpp: Get rid of std::is_trivial which is deprecated in C++26.
85
86 Changes in version 12.8, 12/04/2025
87 ===================================
88
89 * Vectorize primesieve::iterator.prev_prime() using AVX512.
90 * api.cpp: Tune sieve array size.
91 * PreSieve.cpp: Simplify SIMD code.
92 * PreSieve_default.hpp: New algorithm that is also fast using -Os and -O2.
93 * PreSieve_arm_neon.hpp: New file, contains ARM NEON algorithm.
94 * PreSieve_arm_sve.hpp: New file, contains ARM SVE algorithm.
95 * PreSieve_x86_avx512.hpp: New file, contains AVX512 algorithm.
96 * PreSieve_x86_sse2.hpp: New file, contains SSE2 algorithm.
97 * ci/benchmark.yaml: Add CI test to detect performance regressions.
98 * README.md: Fix Markdown math formula.
99 * README.md: Add stress testing section.
100 * C_API.md: Fix Markdown math formula.
101 * CPP_API.md: Fix Markdown math formula.
102
103 Changes in version 12.7, 28/02/2025
104 ===================================
105
106 * multiarch_sve_arm.cmake: Improve ARM SVE detection.
107 * src/arch/arm/sve.cpp: Detect ARM SVE on Linux and Windows.
108 * EratBig.cpp: Simplify bucket handling.
109 * Erat.cpp: Tune sieve size using FACTOR_SIEVESIZE.
110 * README.md: Add Sponsors section.
111
112 Changes in version 12.6, 11/11/2024
113 ===================================
114
115 * CpuInfo.cpp: Correctly detect Intel Arrow Lake CPU cache
116 topology on Windows and Linux.
117 * PreSieve.cpp: Increased pre-sieving from primes <= 100 to
118 primes <= 163. Memory usage of pre-sieve lookup tables has been
119 reduced from 210 kilobytes to 123 kilobytes.
120 * PreSieve.cpp: Added AVX512 and ARM SVE multiarch support.
121
122 Changes in version 12.5, 22/10/2024
123 ===================================
124
125 * Improve thread load balancing for large number of CPU cores.
126
127 Changes in version 12.4, 22/06/2024
128 ===================================
129
130 * Move x86 CPUID code from cpuid.hpp to src/x86/cpuid.cpp.
131 * multiarch_x86_popcnt.cmake: Detect x86 POPCNT support.
132 * CMakeLists.txt: Use CMake list for all compile time definitions.
133 * CMakeLists.txt: Use CMake list for all link libraries.
134
135 Changes in version 12.3, 15/04/2024
136 ===================================
137
138 * Improve Windows multiarch support (now works with MinGW64).
139 * Add runtime POPCNT detection using CPUID for x86 CPUs.
140 * Improve GCC/Clang multiarch preprocessor logic.
141 * CMakeLists.txt: Remove POPCNT/BMI check for x86 CPUs.
142
143 Changes in version 12.2, 30/03/2024
144 ===================================
145
146 * RiemannR.cpp: Fix infinite loop on Linux i386,
147 see https://github.com/kimwalisch/primecount/issues/66.
148 * RiemannR.cpp: Faster and simpler RiemannR_inverse(x).
149 * config.hpp: Tune FACTOR_ERATMEDIUM for AMD Zen 4.
150 * test/Riemann_R.cpp: Add more tests.
151
152 Changes in version 12.1, 09/03/2024
153 ===================================
154
155 CMakeLists.txt: Fix undefined reference to pthread_create #146.
156 PrimeSieve.cpp: Improve status output.
157 src/app/test.cpp: Fix -ffast-math failure.
158 test/count_primes2.cpp: Fix -ffast-math failure.
159 test/Riemann_R.cpp: Fix musl libc issue #147.
160
161 Changes in version 12.0, 17/02/2024
162 ===================================
163
164 * stressTest.cpp: New --stress-test[=MODE] command-line option.
165 * RiemannR.cpp: Faster Riemann R function implementation #144.
166 * CmdOptions.cpp: New -R && --RiemannR command line options.
167 * CmdOptions.cpp: New --RiemannR-inverse command line option.
168 * CmdOptions.cpp: Add new --timeout option for stress testing.
169 * main.cpp: Improve command-line option handling.
170
171 Changes in version 11.2, 08/01/2024
172 ===================================
173
174 * nthPrime.cpp: Rewritten using faster nth prime approximation.
175 * nthPrimeApprox.cpp: Logarithmic integral and Riemann R implementations.
176 * cmake/libatomic.cmake: Fix failed to find libatomic #141.
177 * .github/workflows/ci.yml: Port AppVeyor CI tests to GitHub Actions.
178 * doc/C_API.md: Fix off by 1 error in OpenMP example #137.
179 * doc/CPP_API.md: Fix off by 1 error in OpenMP example #137.
180 * Vector.hpp: Rename pod_vector to Vector and pod_array to Array.
181 * iterator.h: Improve documentation.
182 * iterator.hpp: Improve documentation.
183 * C_API.md: Add SIMD (vectorization) section.
184 * CPP_API.md: Add SIMD (vectorization) section.
185 * README.md: Add C & C++ API badges.
186
187 Changes in version 11.1, 12/05/2023
188 ===================================
189
190 When primesieve is distributed via distro package managers, it is often
191 not compiled using the highest optimization level -O3. Because of this
192 primesieve's pre-sieving algorithm was not auto-vectorized in many
193 cases. As a workaround for this issue I have now manually vectorized
194 the pre-sieving algorithm for x64 CPUs (using portable SSE2) and for
195 ARM64 CPUs (using portable ARM NEON). This can improve performance by
196 up to 40%.
197
198 * PreSieve.cpp: Vectorize loop using x64 SSE2 & ARM NEON.
199 * popcount.cpp: Add POPCNT algorithm for x64 & AArch64.
200 * primesieve.h: Fix -Wstrict-prototypes warning.
201 * examples/c/*.c: Fix -Wstrict-prototypes warning.
202 * test/*.c: Fix -Wstrict-prototypes warning.
203 * CMakeLists.txt: New WITH_AUTO_VECTORIZATION option (with default ON).
204 * cmake/auto_vectorize.cmake: Enable auto-vectorization if the compiler
205 supports it.
206 * scripts/build_mingw64_x64.sh: Build primesieve x64 release binary.
207 * scripts/build_mingw64_arm64.sh: Build primesieve arm64 release binary.
208
209 Changes in version 11.0, 02/12/2022
210 ===================================
211
212 The primesieve major version has been increased from 8 to 11 in order
213 for the primesieve major version to match the libprimesieve.so (ABI)
214 version. From now on, the primesieve version and the libprimesieve.so
215 version will be kept in sync.
216
217 The libprimesieve C API and ABI remain backwards compatible with
218 primesieve-8.*. In primesieve-11.0 the C primesieve_skipto() function
219 has been marked as deprecated and primesieve_jump_to() has been added
220 as a replacement.
221
222 The libprimesieve C++ API and ABI are not backwards compatible. The
223 primesieve::iterator::skipto() method has been removed and replaced by
224 the new primesieve::iterator::jump_to().
225
226 Please note that the new primesieve_jump_to(iter, start, stop) includes
227 the start number (generates primes >= start), whereas the old
228 primesieve_skipto(iter, start, stop) excludes the start number
229 (generates primes > start). In practice, the use of primesieve_jump_to()
230 requires up to 2x less start number corrections (e.g. start-1) compared
231 to primesieve_skipto().
232
233 * CMakeLists.txt: Improve Emscripten WebAssembly support.
234 * iterator.cpp: Add new primesieve::iterator::jump_to().
235 * iterator.cpp: Fix use after free in primesieve::iterator::clear().
236 * iterator-c.cpp: Add new primesieve_jump_to().
237 * iterator-c.cpp: Mark primesieve_skipto() as deprecated.
238 * iterator-c.cpp: Fix use after free in primesieve_iterator_clear().
239 * pod_vector.hpp: Added support for types with destructors.
240 * malloc_vector.hpp: Fix potential memory leak.
241 * api.cpp: Support non power of 2 sieve sizes.
242 * PrimeSieve.cpp: Support non power of 2 sieve sizes.
243 * PreSieve.cpp: Use std::initializer_list instead of std::vector.
244 * Erat.cpp: Improve documentation.
245 * C_API.md: Improve next_prime() and prev_prime() documentation.
246 * CPP_API.md: Improve next_prime() and prev_prime() documentation.
247
248 Changes in version 8.0, 26/06/2022
249 ==================================
250
251 There has been a minor change in the ABI (Application binary interface) of
252 libprimesieve-8.0 compared to libprimesieve-7.x. This ABI break was necessary
253 to fix undefined behavior present in libprimesieve-7.x
254 (in primesieve::iterator). For more information, please read:
255 https://github.com/kimwalisch/primesieve/wiki/libprimesieve-8.0-ABI-changes
256
257 * primesieve::iterator's ABI has been modified in both the C & C++ API.
258 primesieve::iterator's API remains backwards compatible.
259 * CPP_API.md: Renamed doc/CPP_Examples.md to doc/CPP_API.md.
260 * C_API.md: Renamed doc/C_Examples.md to doc/C_API.md.
261 * Fix undefined behavior (g++-12 issue) caused by resizeUninitialized.hpp,
262 use new pod_vector<uint64_t> from pod_vector.hpp instead.
263 * iterator.cpp: Enable pre-sieving for primesieve::iterator.prev_prime().
264 * iterator-c.cpp: Enable pre-sieving for primesieve::iterator.prev_prime().
265 * PreSieve.cpp: Detect if the user sieves many consective intervals.
266 * PrimeGenerator.cpp: Improve AVX512 of fillNextPrimes().
267 * PrimeGenerator.cpp: Reduce memory usage for tiny stop numbers.
268 * PrimeGenerator.hpp: Add GCC/Clang's function multiversioning for AVX512.
269 * Erat.cpp: Dynamically grow the sieve size: use a small sieve size for
270 small stop numbers and a large sieve size for large stop numbers.
271 * Erat.cpp: Reduce memory usage, allocate the minimum required
272 memory to store all sieving primes.
273 * CpuInfo.cpp: Detect AVX512 using CPUID.
274 * pmath.hpp: Use compiler instrinsics for ilog2() & floorPow2().
275 * StorePrimes.hpp: Use vector::insert() instead of vector::push_back(),
276 see: https://github.com/kimwalisch/primesieve/issues/123.
277 * CMakeLists.txt: Automatically enable expensive debug assertions in debug
278 mode (if CMAKE_BUILD_TYPE=Debug).
279
280 Changes in version 7.9, 03/05/2022
281 ==================================
282
283 * intrinsics.hpp: Improved x64 BSF assembly.
284 * iterator.cpp: Reduce memory allocations in generate_prev_primes().
285 * iterator-c.cpp: Reduce memory allocations.
286 * CpuInfo.cpp: Improve hybrid CPU detection on Linux.
287 * Erat.cpp: Reduce memory usage when sieving a single segment.
288 * EratBig.cpp: Improve instruction level parallelism.
289 * EratBig.cpp: Improve next wheel index code.
290 * EratBig.cpp: Use std::copy() instead of std::rotate().
291 * SievingPrimes.cpp: Reduce branch mispredictions.
292 * PreSieve.cpp: Hardcode buffersDist.
293 * MemoryPool.cpp: Reduce memory usage.
294 * StorePrimes.hpp: Improve nth prime approximation.
295 * config.hpp: Tune FACTOR_ERATMEDIUM constant.
296 * Use a single MemoryPool per thread (previously 2).
297 * Increase max sieve array size to 8 KiB.
298
299 Changes in version 7.8, 21/01/2022
300 ==================================
301
302 primesieve can now pre-sieve the multiples of small primes < 100
303 (previously <= 19) using about only half as much memory. Instead
304 of using a single large pre-sieved buffer primesieve now uses
305 8 smaller pre-sieved buffers which are bitwise AND together before
306 being copied into the sieve array. The new pre-sieveing algorithm
307 provides a speedup of up to 10% when generating the primes < 10^11.
308 Thanks to @zielaj for this amazing work!
309
310 * PreSieve.cpp: Add multiple pre-sieve buffers #110.
311 * PrimeGenerator.cpp: Reduce branch mispredictions #109.
312 * PrimeGenerator.cpp: Add AVX512 algorithm #109.
313 * iterator.cpp: Avoid default initialization of primes vector.
314 * iterator-c.cpp: Avoid default initialization of primes vector.
315 * ParallelSieve.cpp: Initialize PreSieve.
316 * ALGORITHMS.md: Update documentation.
317
318 Changes in version 7.7, 13/11/2021
319 ==================================
320
321 The CPU cache size detection has been improved. The code now better
322 handles uncertain situations when CPU cache information is only
323 partially available. If the CPU cache detection fails entirely, then
324 the new code uses a larger sieve size (than before) that will most
325 likely provide a significant speedup. Most BSD operating systems
326 that are currently not supported in CpuInfo.cpp will benefit from
327 this change.
328
329 The behavior of the -q/--quiet option has been modified. Before it
330 printed e.g. "Primes: 1229", while with the new behavior the
331 "Primes:" label will not be printed anymore. Hence the new output
332 will be "1229". This is a backwards incompatible change, however I
333 won't increase primesieve's major version since this change does not
334 affect primesieve's API/ABI.
335
336 * CpuInfo.cpp: Fix issues with big.LITTLE CPUs #105.
337 * api.cpp: Simplify private L2 cache size detection #103.
338 * config.cpp: Add fallback sieve size & L1 data cache size.
339 * Erat.cpp: If runtime CPU cache detection fails use
340 config::L1D_CACHE_BYTES.
341 * main.cpp: Improve -q/--quiet option #102.
342 * api-c.cpp: Print error messages to stderr.
343 * iterator-c.cpp: Print error messages to stderr.
344 * doc/primesieve.1: Update man page.
345 * CMakeLists.txt: Add WITH_MSVC_CRT_STATIC option to force static linking.
346 * C_Examples.md: Add CMake build instructions.
347 * CPP_Examples.md: Add CMake build instructions.
348
349 Changes in version 7.6, 18/12/2020
350 ==================================
351
352 * The primesieve GUI application has been deprecated/removed.
353 It only works with QT4 which has reached end-of-life.
354 * Get rid Travis-CI because it is not free anymore.
355 * CpuInfo.cpp: Linux kernel CPU detection has been updated.
356 * CpuInfo.cpp: Add workaround for sysctl bug (macOS & iOS).
357 * Erat.hpp: Use CTZ instruction on x64 and ARM64 CPUs.
358 * config.hpp: Tune FACTOR_ERATSMALL factor.
359 * EratSmall.cpp: Get rid of goto.
360 * EratSmall.cpp: Optimize switch statement.
361 * EratSmall.cpp: Annotate switch cases with fallthrough.
362 * EratMedium.cpp: Get rid of goto.
363 * EratMedium.cpp: Optimize switch statements.
364 * EratMedium.cpp: Annotate switch cases with fallthrough.
365 * EratBig.cpp: Simplify main sieving loop.
366 * doc/C_Examples.md: libprimesieve C code examples.
367 * doc/CPP_Examples.md: libprimesieve C++ code examples.
368
369 Changes in version 7.5, 27/12/2019
370 ==================================
371
372 This is a minor new release, the API and ABI (Application binary
373 interface) are backwards compatible.
374
375 primesieve::iterator::next_prime() has been sped up by about 10%.
376 Since primesieve::iterator is also used under the hood for
377 generating an array (or vector) of primes that should also run
378 slightly faster.
379
380 I have also removed the https://primesieve.org website because it
381 simply took too much effort to maintain it and make it look nice
382 across all devices, operating systems and browsers.
383 Hence primesieve's main homepage is now its GitHub repo:
384 https://github.com/kimwalisch/primesieve
385
386 * Erat.cpp: Silence MSVC debug warning.
387 * StorePrimes.hpp: Add workaround for windows.h max/min macros.
388 * PrimeGenerator.cpp: Cache more primes.
389 * SievingPrimes.cpp: Cache more primes.
390 * CmdOptions.cpp: Support options of type: --option VALUE.
391 * help.cpp: Improve help menu.
392 * CMakeLists.txt: Require CMake 3.4 instead 3.9.
393 * primesieve.pc.in: Fix libdir and includedir.
394 * README.md: Add libprimesieve multi-threading section.
395 * BUILD.md: Add detailed build instructions.
396 * doc/ALGORITHMS.md: Info from https://primesieve.org.
397 * doc/primesieve.txt: New AsciiDoc man page.
398
399 Changes in version 7.4, 10/02/2019
400 ==================================
401
402 This is a minor new release, the API and ABI (Application binary
403 interface) are backwards compatible.
404
405 * CpuInfo.cpp: Fix MinGW CPU detection.
406 * CMakeLists.txt: Fix cross compilation bug.
407 * Add --test option: Runs self tests.
408 * IteratorHelper.cpp: Improve caching of small primes.
409 * ParallelSieve.cpp: Non-blocking status updates.
410 * PrimeSieve.cpp: Simplify status update.
411 * travis.yml: Test using GCC 5, 6, 7, 8, Clang 7 and MinGW.
412
413 Changes in version 7.3, 04/01/2019
414 ==================================
415
416 This is a minor new release, the API and ABI (Application binary
417 interface) are backwards compatible.
418
419 primesieve-7.3 improves the cache efficiency of the sieving algorithm
420 for large sieving primes. By using aligned memory it is possible
421 to reduce the number of pointer indirections which reduces cache
422 pollution. I have measured a speed up of 15% near 1e18 and a speed up
423 of 25% near 1e19.
424
425 * EratBig.cpp: Improve cache efficiency.
426 * MemoryPoop.cpp: Allocate buckets aligned by sizeof(Bucket).
427 * Bucket.hpp: sizeof(Bucket) is now a power of 2.
428 * primesieve::iterator: Support C++ move semantics.
429 * CmdOptions.cpp: Fix array out of bounds bug.
430 * CpuInfo.cpp: Fix MinGW/MSYS2 -Wcast-function-type warning.
431
432 Changes in version 7.2, 26/10/2018
433 ==================================
434
435 This is a minor new release, the API and ABI (Application binary
436 interface) are backwards compatible.
437
438 primesieve-7.2 features a new algorithm for medium sieving primes
439 that improves the CPU's branch prediction rate by sorting the sieving
440 primes (before using them). On AMD EPYC CPUs I have measured a
441 speedup of up to 15% and on Intel Skylake CPUs I have measured a
442 speedup of up to 10%. Ever since primesieve was created in 2010 its
443 algorithm for medium sieving primes has been slower than yafu's
444 algorithm for medium sieving primes. This performance issue has now
445 been fixed!
446
447 * EratMedium.cpp: New faster sieving algorithm.
448 * EratSmall.cpp: Slightly reduce the number of instructions.
449 * MemoryPool.cpp: Move memory pool into its own class.
450 * CMakeLists.txt: Add support for primesieve.dll.
451
452 Changes in version 7.1, 19/08/2018
453 ==================================
454
455 This is a minor new release, the API and ABI (Application binary
456 interface) are backwards compatible.
457
458 primesieve-7.1 runs up to 30% faster on Intel Skylake-X CPUs!
459 The default sieve size is now (L2 cache size / 2). Using a sieve size
460 that is slightly smaller than the L2 cache size reduces the number
461 of L2 cache misses which improves performance on CPUs with slow L3
462 caches. primesieve-7.1 will also run slightly faster (< 3%) on most
463 other Intel CPUs.
464
465 * api.cpp: Default sieve size = (L2 cache size / 2).
466 * CpuInfo.cpp: Improved CPU info detection.
467 * Erat.cpp: Lazy PreSieve initialization.
468 * EratSmall.cpp: Fix too large sieve size.
469 * help.cpp: Update help menu (--help).
470 * ParallelSieve.cpp: Improved load balancing.
471 * --cpu-info: New option, prints CPU information.
472 * Rename kilobytes to KiB because it is more accurate.
473 * Faster Windows binary built using clang-cl.
474
475 Changes in version 7.0, 25/04/2018
476 ==================================
477
478 This is a major new release, the API is backwards compatible but the
479 ABI (Application binary interface) is not backwards compatible.
480
481 primesieve's core algorithms have been rewritten using next_prime()
482 instead of callbacks. The benefit of this redesign is a much improved
483 primesieve::iterator that runs up to twice as fast and uses only
484 half as much memory as before!
485
486 * primesieve::iterator: Faster next_prime().
487 * primesieve::iterator: Cache small primes in lookup table.
488 * PrimeGenerator.cpp: Incrementally store primes in a vector.
489 * StorePrimes.hpp: Use primesieve::iterator instead of callbacks.
490 * SievingPrimes.hpp: Use next_prime() instead of callbacks.
491 * Reduce number of memory allocations by up to 30%.
492 * Modernize code base using C++11.
493 * Test suite runs up to twice as fast.
494
495 ## Breaking ABI Changes:
496
497 New variables have been added to the C++ primesieve::iterator class
498 and the C primesieve_iterator struct. Users that have written
499 primesieve bindings for other programming languages are affected
500 by these ABI changes and need to update their code.
501
502 Changes in version 6.4, 23/03/2018
503 ==================================
504
505 This is a minor new release, the API and ABI are backwards compatible.
506
507 * Switch to https: https://primesieve.org.
508 * Faster printing to stdout.
509 * Required CMake version is now 3.4 (previously 3.1)
510 * CMakeLists.txt: Support find_package(primesieve).
511 * CMakeLists.txt: Add Fedora multiarch support.
512 * CMakeLists.txt: Fix libatomic detection.
513 * CMakeLists.txt: Fix make install issue.
514 * calculator.hpp: Fix integer overflow.
515 * test/calculator.cpp: Add test for expression parser.
516
517 ## Breaking Changes:
518
519 The 2 changes below may potentially break the build of projects that
520 have hardcoded the src/primesieve path and/or the
521 src/primesieve/README filename in their build script.
522
523 * Move libprimesieve sources from ./src/primesieve to ./src.
524 * Rename src/primesieve/README to src/README.md.
525
526 Changes in version 6.3, 12/11/2017
527 ==================================
528
529 This is a minor new release, the API and ABI are
530 backwards compatible.
531
532 * test/ilog2.cpp: Fix Linux i386 bug.
533 * test/floorPower2.cpp: Fix Linux i386 bug.
534 * CMakeLists.txt: Link against libatomic if needed.
535 * CMakeLists.txt: Add Debian Multiarch support.
536
537 Changes in version 6.2, 12/10/2017
538 ==================================
539
540 This is a minor new release which fixes 2 bugs and improves
541 the primesieve GUI app. The API and ABI are backwards
542 compatible.
543
544 * pmath.hpp: Fix integer overflow.
545 * EratMedium.cpp: Fix vector out of bounds bugs.
546 * primesieve GUI app: Silence GCC 7 warnings.
547 * PrimeSieveGUI.cpp: Add option to sieve using
548 (CPU cores / 2) threads.
549
550 Changes in version 6.1, 12/08/2017
551 ==================================
552
553 primesieve-6.1 features run-time CPU cache size detection and
554 an L2 cache size optimization contributed by Huang YuanBing
555 which speeds up sieving by up to 20% on recent CPUs (>= 2012).
556 By default primesieve now uses a sieve size that fits into the
557 CPU's L1 cache for small sieving primes and a sieve size that
558 fits into the CPU's L2 cache for medium and big sieving
559 primes.
560
561 The API and ABI are backwards compatible.
562
563 1. CpuInfo.cpp: Runtime CPU cache size detection.
564 2. api.cpp: sieve size = L2 cache size.
565 3. EratSmall.cpp: L1 cache size optimization.
566 4. EratMedium.cpp: Reduce allocations.
567 5. Silence GCC 7 warnings.
568 6. Fix GCC 7 performance regression.
569
570 Changes in version 6.0, 01/05/2017
571 ==================================
572
573 primesieve-6.0 is a major new release with many changes. The API and
574 ABI are not backwards compatible, see the "API changes" sections
575 further down for more information.
576
577 1. Use CMake build system instead of Autotools.
578 2. Use C++11 instead of C++98.
579 3. Use C++11 threads instead of OpenMP.
580 4. C/C++ API is now parallel by default.
581 5. Add many C/C++ libprimesieve tests (./test).
582 6. Improved error messages.
583
584 C++ API changes
585 ---------------
586
587 The C++ API is now parallel by default i.e. the
588 primesieve::count_*() and primesieve::nth_prime() functions use all
589 CPU cores. Hence the old primesieve::parallel_*() functions have been
590 removed.
591
592 Removed from C++ API:
593
594 uint64_t parallel_count_primes(uint64_t start, uint64_t stop);
595 uint64_t parallel_count_twins(uint64_t start, uint64_t stop);
596 uint64_t parallel_count_triplets(uint64_t start, uint64_t stop);
597 uint64_t parallel_count_quadruplets(uint64_t start, uint64_t stop);
598 uint64_t parallel_count_quintuplets(uint64_t start, uint64_t stop);
599 uint64_t parallel_count_sextuplets(uint64_t start, uint64_t stop);
600 uint64_t parallel_nth_prime(int64_t n, uint64_t start = 0);
601
602 void callback_primes(uint64_t start, uint64_t stop, void (*callback)(uint64_t prime));
603 void callback_primes(uint64_t start, uint64_t stop, primesieve::Callback<uint64_t>* callback);
604 bool primesieve_test();
605
606 C API changes
607 -------------
608
609 The C API is now parallel by default i.e. the
610 primesieve_count_*() and primesieve_nth_prime() functions use all
611 CPU cores. Hence the old primesieve_parallel_*() functions have been
612 removed.
613
614 Removed from C API:
615
616 uint64_t primesieve_parallel_count_primes(uint64_t start, uint64_t stop);
617 uint64_t primesieve_parallel_count_twins(uint64_t start, uint64_t stop);
618 uint64_t primesieve_parallel_count_triplets(uint64_t start, uint64_t stop);
619 uint64_t primesieve_parallel_count_quadruplets(uint64_t start, uint64_t stop);
620 uint64_t primesieve_parallel_count_quintuplets(uint64_t start, uint64_t stop);
621 uint64_t primesieve_parallel_count_sextuplets(uint64_t start, uint64_t stop);
622 uint64_t primesieve_parallel_nth_prime(int64_t n, uint64_t start);
623
624 void primesieve_callback_primes(uint64_t start, uint64_t stop, void (*callback)(uint64_t prime));
625 int primesieve_test();
626
627 Changes in version 5.7.3, 19/11/2016
628 ====================================
629
630 The API and ABI are backwards compatible.
631
632 1. New ./configure option: --enable-maintainer-mode
633 If this option is used the primesieve man page will be
634 regenerated in the make step.
635 See doc/README.md for more information.
636
637 Changes in version 5.7.2, 21/08/2016
638 ====================================
639
640 The API and ABI are backwards compatible.
641
642 1. doc/primesieve.1: Add primesieve man page.
643 2. configure.ac: Add --with-help2man option to regenerate man page.
644 3. scripts/update_version.sh: Script that automatically updates the
645 version in all files, see RELEASE.md for more information.
646
647 Changes in version 5.7.1, 13/08/2016
648 ====================================
649
650 The API and ABI are backwards compatible.
651
652 1. New --no-status command-line option to turn off the progressing
653 status while counting primes or prime k-tuplets.
654 2. README.md: New "Package managers" section.
655
656 Changes in version 5.7.0, 31/07/2016
657 ====================================
658
659 1. primesieve can now find primes up to 2^64-1 (UINT64_MAX), the
660 previous limit was 2^64 - 2^32 * 10. Thanks to Huang Yuanbing
661 (author of ktprime) for submitting the patch.
662 2. Cleaned up pre-sieving: uses less memory + faster initialization.
663 3. Faster primesieve::iterator initialization.
664
665 C/C++ API changes
666 -----------------
667
668 The MAX_THREADS constant has been removed.
669
670 Changes in version 5.6.0, 29/11/2015
671 ====================================
672
673 1. The C API prime generation functions now return true C arrays which
674 can be deallocated using free() in the user's code.
675 2. New high resolution icon size for primesieve GUI app.
676 3. primesieve GUI app: Bug fix for CPUs with L1 data cache size that
677 is not a power of 2 e.g. Intel Z2480 Atom (24 KB L1 cache).
678 4. Renamed doxygen directory to doc.
679 5. doc/Doxyfile.in: Fix out of source builds.
680
681 C++ API changes
682 ---------------
683
684 All parallel callback functions have been removed. This was just crazy
685 functionality which I should never have implemented ...
686
687 void parallel_callback_primes(uint64_t start, uint64_t stop, void (*callback)(uint64_t prime));
688 void parallel_callback_primes(uint64_t start, uint64_t stop, primesieve::Callback<uint64_t>* callback);
689 void parallel_callback_primes(uint64_t start, uint64_t stop, void (*callback)(uint64_t prime, int thread_id));
690 void parallel_callback_primes(uint64_t start, uint64_t stop, primesieve::Callback<uint64_t, int>* callback);
691
692 C API changes
693 -------------
694
695 All parallel callback functions have been removed:
696
697 void primesieve_parallel_callback_primes(uint64_t start, uint64_t stop, void (*callback)(uint64_t prime, int thread_id));
698
699
700 Changes in version 5.5.0, 06/11/2015
701 ====================================
702
703 This release contains many small incremental improvements. There are
704 2 minor backwards incompatible API changes which are described further
705 down.
706
707 1. primesieve GUI app: Runtime detection of CPU L1 cache size.
708 2. primesieve.pc.in: Added support for pkg-config.
709 3. appveyor.yml: Automated Windows (MSVC++) testing.
710 4. README.md: New "Bindings for other languages" section.
711 5. include/config.h: tune for Intel Skylake CPUs.
712 6. include/WheelFactorization.hpp: Slightly faster initialization.
713 7. src/primesieve/EratMedium.cpp: Unroll sieving loop, up to 5% speed up.
714 8. src/primesieve/popcount.cpp: Faster popcount algorithm.
715 9. examples/c/previous_prime.c: Shows how to use primesieve_previous_prime().
716
717 C++ API changes
718 ---------------
719
720 primesieve::test() has been renamed to primesieve::primesieve_test()
721 in order to prevent naming collisions.
722
723 primesieve::iterator::previous_prime() now returns 0 if input <= 2,
724 previously an error was thrown. Rationale of this change:
725 https://github.com/kimwalisch/primesieve/issues/11#issuecomment-148939336
726
727 C API changes
728 -------------
729
730 primesieve_previous_prime() now returns 0 if input <= 2, previously
731 PRIMESIEVE_ERROR was returned. Rationale of this change:
732 https://github.com/kimwalisch/primesieve/issues/11#issuecomment-148939336
733
734 Changes in version 5.4.2, 04/04/2015
735 ====================================
736
737 This is a minor new release, the API and ABI are backwards compatible.
738
739 1. Use silent building on Unix-like operating systems.
740 2. Add screenshot to README.md.
741 3. Makefile.am: Add autogen.sh to EXTRA_DIST.
742
743 Changes in version 5.4.1, 09/11/2014
744 ====================================
745
746 This is a minor new release, the API and ABI are backwards compatible.
747
748 1. Fixed a bug in the configure.ac script which used SIEVESIZE=0
749 instead of SIEVESIZE=32 on QEMU virtual machines.
750 2. Introduce patch version (3rd version number) in order not to
751 increase the minor version for bug fix only releases.
752
753 Changes in version 5.4, 14/09/2014
754 ==================================
755
756 This is a minor new release which fixes two bugs in the computation of
757 prime k-tuplets (twin primes, prime triplets, ...).
758
759 1. The primesieve::print_*() functions for prime k-tuplets have been
760 fixed, they were broken since primesieve-5.1.
761 https://github.com/kimwalisch/primesieve/commit/ff2fb6f7acfb7c83827803dbb09a73f4a47ab222
762
763 2. Prime 7-tuplets have been removed from primesieve (see API changes
764 further down). Below are the two modulo 30 patterns for prime
765 7-tuplets:
766
767 1) 30*k + { 7, 11, 13, 17, 19, 23, 29}
768 2) 30*k + {29, 31, 37, 41, 43, 47, 49}
769
770 Up until now primesieve only found prime 7-tuplets of the first
771 pattern e.g. it missed 5610 + {29, 31, ...}. Unfortunately this bug
772 cannot be fixed because of implementation constraints. Thus I have
773 decided to completely remove prime 7-tuplets from primesieve.
774
775 C++ API changes
776 ---------------
777
778 All functions related to prime 7-tuplets have been removed:
779
780 uint64_t primesieve::print_septuplets(uint64_t start, uint64_t stop);
781 uint64_t primesieve::count_septuplets(uint64_t start, uint64_t stop);
782 uint64_t primesieve::parallel_count_septuplets(uint64_t start, uint64_t stop);
783
784 C API changes
785 -------------
786
787 All functions related to prime 7-tuplets have been removed:
788
789 uint64_t primesieve_print_septuplets(uint64_t start, uint64_t stop);
790 uint64_t primesieve_count_septuplets(uint64_t start, uint64_t stop);
791 uint64_t primesieve_parallel_count_septuplets(uint64_t start, uint64_t stop);
792
793 Changes in version 5.3, 06/07/2014
794 ==================================
795
796 This is a minor new release with an important bug fix and improved
797 documentation, the API and ABI are backwards compatible.
798
799 1. Fix use of uninitialized variable bug in primesieve::iterator:
800 https://github.com/kimwalisch/primesieve/commit/006d572ea8fa4958eaf46c1db24c983b1ce27e1b
801 2. README.md update: Explain how to build from master-branch.
802 3. New file HACKING.md: Explains source tree, useful for developers.
803
804 Changes in version 5.2, 13/04/2014
805 ==================================
806
807 1. Added backwards nth prime search, if n < 0
808 primesieve::nth_prime(int64_t n, uint64_t start);
809 will find the nth prime < start.
810 2. Faster nth prime implementation, more accurate guessing of the nth
811 prime gives up to 20% speed up if n < 10^8.
812 3. Added continuous integration testing with Travis (travis-ci.org),
813 files: .travis.yml, Readme.md (shows build status).
814
815 API changes!!!
816
817 In order to be compatible with other mathematical software like
818 Mathematica, Maple and SymPy the functions below have been modified
819 to return a prime > start (or < start), previously these functions
820 returned a prime >= start (or <= start).
821
822 uint64_t primesieve::nth_prime(int64_t n, uint64_t start);
823 uint64_t primesieve::iterator::next_prime();
824 uint64_t primesieve::iterator::previous_prime();
825
826 Changes in version 5.1, 14/02/2014
827 ==================================
828
829 primesieve-5.1 is a minor new release with mostly bug fixes. There is
830 also one API change in the C bindings documented further down.
831
832 1. <primesieve.hpp> and <primesieve.h> are now compatible with
833 <windows.h>, fixed CALLBACK and max() issues.
834 2. Fixed bug in primesieve::iterator::previous_prime().
835 3. Fixed bug in primesieve_previous_prime().
836 4. Added stop_hint optimization to primesieve::iterator which gives a
837 significant speed up if only few primes are generated.
838 5. Replaced GENERATE_PRIMES() macro by templatized callbackPrimes()
839 method (src/primesieve/PrimeFinder.cpp).
840
841 C bindings API change:
842
843 void primesieve_skipto(primesieve_iterator* pi, uint64_t start, uint64_t stop_hint);
844
845 The signature of the primesieve_skipto() function has changed, a new
846 'stop_hint' parameter has been added. Please refer to
847 http://primesieve.org/api/primesieve__iterator_8h.html for more
848 information.
849
850 Changes in version 5.0, 11/01/2014
851 ==================================
852
853 primesieve-5.0 is a major new release that makes using the primesieve
854 library much more convenient. primesieve now includes C bindings for
855 all of its functions so that it can easily be used in languages other
856 than C++. I moved primesieve's build system to GNU Autotools and
857 Libtool which is more reliable than the hand written Makefile I used
858 previously.
859
860 primesieve-5.0 features a new API completely written from scratch that
861 is easier to use and that will not break binary compatibility with
862 every new release. The new API is not backwards compatible but porting
863 your code to the new API should be done quickly. You can explore
864 primesieve's new API online at: http://primesieve.org/api.
865
866 I bought a domain for primesieve and moved primesieve's repository
867 from Google Code (SVN) to GitHub (git):
868
869 http://primesieve.org
870 http://github.com/kimwalisch/primesieve
871
872 Other changes:
873
874 1. New primesieve::iterator class that provides next_prime() and
875 previous_prime() methods.
876 2. ParallelPrimeSieve now uses multi-threading by default, it does not
877 care about arithmetic order anymore. Please do not use
878 ParallelPrimeSieve directly anymore instead use the new API.
879 3. Renamed src/soe to src/primesieve.
880 4. Renamed PrimeSieveCallback<T> class to Callback<T>.
881 5. Moved most header files to include/primesieve.
882
883 Changes in version 4.4, 19/09/2013
884 ==================================
885
886 This is a minor release whose sole purpose is to fix a bug in the
887 Makefile which is required for integrating primesieve into
888 Sage (http://www.sagemath.org).
889
890 1. Fixed the following bug:
891 $ make shared && make install PREFIX=/user-path
892 2. PrimeSieve does not throw an exception anymore if (start > stop)
893 instead it simply ignores the invalid input.
894 3. `make SHARED=yes` has been deprecated, use `make shared` instead.
895
896 Changes in version 4.3, 05/07/2013
897 ==================================
898
899 This release improves primesieve as a library and adds an algorithm
900 to find the nth prime. The API of primesieve 4.3 is backwards
901 compatible but the ABI is not (you must recompile your application if
902 you want to link against a shared libprimesieve 4.3).
903
904 1. Support for storing primes in C++ vectors:
905 PrimeSieve::generatePrimes (start, stop, std::vector<T>*);
906 PrimeSieve::generate_N_Primes(start, n, std::vector<T>*);
907 2. New algorithm to find the nth prime:
908 PrimeSieve::nthPrime(n);
909 PrimeSieve::nthPrime(start, n);
910 3. The Makefiles now build primesieve and a static libprimesieve by
911 default. A shared libprimesieve can be built using:
912 $ make shared
913 4. Added a <primesieve/soe/stop_primesieve.h> header for
914 this commonly used exception to abort sieving.
915 5. Updated the documentation files: INSTALL, doc/API, doc/EXAMPLES
916 doc/LIBPRIMESIEVE, doc/FAQ
917 6. Updated the source code examples in ./examples.
918 7. Added the scripts/install_primesieve.sh shell script that
919 automatically downloads, builds and installs the latest primesieve
920 and libprimesieve version.
921
922 Changes in version 4.2, 10/03/2013
923 ==================================
924
925 1. libprimesieve generates (callback) primes up to 5% faster on
926 little-endian CPUs (x86, x86-64) due to improved
927 endiansafe_cast.h (src/soe).
928 2. The best pre-sieve setting is now automatically chosen at
929 runtime, this speeds up sieving small intervals.
930 3. The Makefile now supports the Solaris OS.
931 4. Updated documentation: README, INSTALL, doc/EXAMPLES, doc/FAQ
932 and doc/LIBPRIMESIEVE. New files: AUTHORS and THANKS.
933 5. Fixed a bug in the primesieve GUI code (doc/BUGS).
934 6. Updated ExpressionParser.h (src/apps/*) to version 2.5.
935 7. Added more example programs: examples/store_primes_in_vector.cpp
936 and examples/nth_prime.cpp.
937 8. Lots of refactoring to make the code easier to understand.
938
939 API changes
940 -----------
941
942 The undocumented pre-sieve methods have been removed
943 (pre-sieving is now automatically configured at runtime).
944
945 void PrimeSieve::getPreSieve();
946 void PrimeSieve::setPreSieve(int);
947
948 Changes in version 4.1, 12/01/2013
949 ==================================
950
951 1. New PrimeSieveCallback interface class that simplifies prime
952 number generation with classes, see doc/EXAMPLES.
953 2. The primesieve console (terminal) application now supports
954 GNU-style long options e.g. --size=256.
955 3. Fixed a bug (for sizeof(int) > 4) in the bit population count
956 algorithm, read BUGS file.
957 4. Updated files: README, INSTALL, doc/EXAMPLES.
958 5. The Makefile now uses the system's default C++ compiler instead
959 of GNU g++ which makes it more portable.
960 6. The primesieve_error class has been moved into its own file
961 src/soe/primesieve_error.h (previously PrimeSieve.h).
962
963 API changes
964 -----------
965
966 The following two overly complex PrimeSieve methods have been
967 removed:
968
969 void PrimeSieve::generatePrimes(uint32_t start, uint32_t stop, void (*)(uint32_t, void*), void*);
970 void PrimeSieve::generatePrimes(uint64_t start, uint64_t stop, void (*)(uint64_t, void*), void*);
971
972 They are replaced by the following two new methods that greatly
973 simplify prime number generation with classes, please refer
974 to doc/EXAMPLES for more information.
975
976 void PrimeSieve::generatePrimes(uint32_t start, uint32_t stop, PrimeSieveCallback<uint32_t>*);
977 void PrimeSieve::generatePrimes(uint32_t start, uint32_t stop, PrimeSieveCallback<uint64_t>*);
978
979 Changes in version 4.0, 18/10/2012
980 ==================================
981
982 primesieve 4.0 is a major new release. A lot of work has been put into
983 documentation and improving primesieve as a library. The API of
984 primesieve 4.0 is backward incompatible with primesieve 3.*, the few
985 changes are documented further down.
986
987 1. Added support for OpenMP 2.*, useful for compilers that do
988 not support OpenMP >= 3.0, e.g. MSVC, Apple g++.
989 2. New examples directory with 12 simple example programs.
990 3. New doc/API file that lists the public member functions of the
991 PrimeSieve and ParallelPrimeSieve C++ classes.
992 4. The Makefile is now POSIX compatible, it works with any POSIX
993 shell e.g. sh, bash, ash, ksh, zsh, ...
994 5. The Makefile now supports MinGW (with MSYS) and Cygwin.
995 6. Fixed a shared libprimesieve bug (read doc/BUGS).
996 7. Up to 10 percent faster prime number generation due to new
997 internal 64-bit getNextPrime() (previously 32-bit).
998 8. New unsynchronized ParallelPrimeSieve::generatePrimes() method
999 that calls back primes in parallel (read EXAMPLES).
1000 9. Faster thread synchronization in ParallelPrimeSieve, replaced slow
1001 OpenMP critical directive with faster omp_test_lock().
1002 10. Optimized prime k-tuplet (twin primes, ...) counting for
1003 out-of-order CPUs (src/soe/PrimeNumberFinder.cpp).
1004 11. New primesieve_error() exception used for all exceptions within
1005 PrimeSieve and ParallelPrimeSieve (read EXAMPLES).
1006 12. New pre-sieve code (src/soe/PreSieve.cpp).
1007 13. Ported the primesieve GUI application from Qt 4 to Qt 5.
1008
1009 API changes
1010 -----------
1011
1012 The PrimeSieve 3.* count methods:
1013
1014 uint64_t getPrimeCount(uint64_t start, uint64_t stop);
1015 uint64_t getTwinCount (uint64_t start, uint64_t stop);
1016 ...
1017
1018 Have been renamed to:
1019
1020 uint64_t countPrimes (uint64_t start, uint64_t stop);
1021 uint64_t countTwins (uint64_t start, uint64_t stop);
1022 uint64_t countTriplets (uint64_t start, uint64_t stop);
1023 uint64_t countQuadruplets(uint64_t start, uint64_t stop);
1024 uint64_t countQuintuplets(uint64_t start, uint64_t stop);
1025 uint64_t countSextuplets (uint64_t start, uint64_t stop);
1026 uint64_t countSeptuplets (uint64_t start, uint64_t stop);
1027
1028 Changes in version 3.8, 13/07/2012
1029 ==================================
1030
1031 1. Improved OOP design of WheelFactorization.h.
1032 2. Minor speed up for big sieving primes ~2% (src/soe/EratBig.cpp),
1033 reduced the number of operations in the main sieving loop.
1034 3. Minor speed up for small sieving primes ~3% (src/soe/EraSmall.cpp),
1035 new inner sieving loop without instruction dependencies that uses
1036 only 12 asm instructions (previously 16).
1037 4. Improved OpenMP load balance in src/soe/ParallelPrimeSieve.cpp.
1038 5. Improved code readability of EratSmall.cpp, EratMedium.cpp,
1039 EratBig.cpp, Erat.cpp and others.
1040 6. The Makefile now automatically detects the CPU's L1 data cache
1041 size on Unix-like OSes (Linux, Mac OS X).
1042 7. Renamed ./docs to ./doc
1043 8. Revised README.txt, added 7. Motivation.
1044 9. Updated INSTALL, LIBPRIMESIEVE and EXAMPLES.
1045 10. Added version #defines to PrimeSieve.h, e.g. for this release:
1046
1047 #define PRIMESIEVE_VERSION "3.8"
1048 #define PRIMESIEVE_MAJOR_VERSION 3
1049 #define PRIMESIEVE_MINOR_VERSION 8
1050 #define PRIMESIEVE_YEAR 2012
1051
1052 Changes in version 3.7, 31/05/2012
1053 ==================================
1054
1055 1. More aggressive inlining (*-inline.h), up to 10 percent faster
1056 prime number generation, up to 20 percent faster initialization.
1057 2. Reduced header file dependencies, libprimesieve now only depends on
1058 PrimeSieve.h or ParallelPrimeSieve.h (and PrimeSieve.h).
1059 3. Updated Makefiles.
1060 4. New template imath.h functions: isqrt(), ilog2(), isPow2(), ...
1061 isqrt() has been rewritten using Newton's algorithm in order to
1062 avoid rounding errors of (int)sqrt((double)n) if n > 10^15.
1063 5. New internal Erat::getNextPrime(...) member function.
1064 6. Replaced old C-style comments with C++ comments.
1065 7. Updated ExpressionParser to version 2.2.
1066 8. uin32_t has been replaced by uint_t in src/soe/*.
1067 9. New int API for PrimeSieve and ParallelPrimeSieve objects, getters
1068 and setters now use int instead of uint32_t.
1069 10. Updated documentation files: README, INSTALL, LIBPRIMESIEVE,
1070 EXAMPLES, VALGRIND, TODO, BUGS.
1071
1072 Changes in version 3.6, 22/04/2012
1073 ==================================
1074
1075 1. Improved code readability and updated source code documentation
1076 (src/soe directory).
1077 2. Removed unused source code. The deprecated API of
1078 PrimeSieve <= 3.4 is not supported anymore, use
1079 PrimeSieve::getStart() instead of PrimeSieve::getStartNumber() ...
1080 The file EXAMPLES contains the up-to-date API.
1081 3. src/soe/EratSmall.cpp has been enhanced to better take advantage of
1082 Instruction-Level Parallelism.
1083
1084 Changes in version 3.5, 07/02/2012
1085 ==================================
1086
1087 1. Bug fix for big-endian CPUs (PowerPC, SPARC), see docs/BUGS.
1088 2. The GNU Makefile now provides an option to build primesieve as
1089 a shared library e.g. `make lib SHARED=yes`.
1090 3. I have rewritten the main documentation files docs/LIBPRIMESIEVE
1091 and docs/EXAMPLES.
1092 4. I have added convenience functions to the PrimeSieve class:
1093
1094 void printPrimes (uint64_t start, uint64_t stop);
1095 void printTwins (uint64_t start, uint64_t stop);
1096 void printTriplets (uint64_t start, uint64_t stop);
1097 void printQuadruplets(uint64_t start, uint64_t stop);
1098 void printQuintuplets(uint64_t start, uint64_t stop);
1099 void printSextuplets (uint64_t start, uint64_t stop);
1100 void printSeptuplets (uint64_t start, uint64_t stop);
1101
1102 uint64_t getPrimeCount (uint64_t start, uint64_t stop);
1103 uint64_t getTwinCount (uint64_t start, uint64_t stop);
1104 uint64_t getTripletCount (uint64_t start, uint64_t stop);
1105 uint64_t getQuadrupletCount(uint64_t start, uint64_t stop);
1106 uint64_t getQuintupletCount(uint64_t start, uint64_t stop);
1107 uint64_t getSextupletCount (uint64_t start, uint64_t stop);
1108 uint64_t getSeptupletCount (uint64_t start, uint64_t stop);
1109
1110 void sieve(uint64_t start, uint64_t stop);
1111 void sieve(uint64_t start, uint64_t stop, uint32_t flags);
1112 void sieve();
1113
1114 5. src/soe/ParallelPrimeSieve.cpp has been rewritten using OpenMP 3.0
1115 (previously OpenMP 2.0). The new OpenMP code is more elegant and
1116 scales better when lots of threads (> 32) are used.
1117 Compiler notes:
1118 OpenMP is now disabled by default for the Microsoft Visual C++
1119 compiler as it currently only supports OpenMP 2.0. Some compilers
1120 e.g. g++ 4.2 even build primesieve with OpenMP <= 2.5 but the
1121 resulting binary miscalculates when sieving > 2^63.
1122 6. Helper classes and functions within src/soe are now defined in the
1123 the newly introduced soe namespace. This makes PrimeSieve more
1124 usable as a library.
1125 7. The header file src/soe/defs.h has been renamed to config.h and its
1126 code readability has been improved.
1127 8. The code of src/console/test.cpp has been simplified.
1128
1129 Changes in version 3.4, 05/01/2012
1130 ==================================
1131
1132 1. I implemented a new algorithm for medium sieving primes that is up
1133 to 20 percent faster on todays out-of-order CPUs,
1134 see src/soe/EratMedium.cpp.
1135 2. I adapted the constants in defs.h due to the new EratMedium
1136 algorithm, the maximum sieveSize is now 4096 kilobytes (previously
1137 2048 kilobytes).
1138 3. I revised the Makefiles and INSTALL file.
1139 4. Added docs/LIBPRIMESIEVE and updated README and
1140 docs/EXAMPLES.
1141
1142 Changes in version 3.3, 19/12/2011
1143 ==================================
1144
1145 1. Minor optimizations in src/soe/EratBig.cpp (2% speed up).
1146 2. Improved code readability and documentation of
1147 src/soe/ParallelPrimeSieve.cpp.
1148 3. The sieveSize must be <= 2048 kilobytes now (previously 8192), this
1149 makes the WheelFactorization.h & EratBase.h code easier to
1150 understand.
1151
1152 Changes in version 3.2, 13/11/2011
1153 ==================================
1154
1155 1. Fixed a bug in src/soe/ParallelPrimeSieve.cpp, see ../docs/BUGS.
1156 2. Added 32-bit prime number generation methods to PrimeSieve.
1157 3. Added a PrimeSieve::cancel_sieving exception that allows to cancel
1158 sieving at run time (see docs/EXAMPLES).
1159 4. ParallelPrimeSieve is now able to generate prime numbers using
1160 multiple threads (previously only multi-threaded counting).
1161 5. The code readability and documentation of WheelFactorization.h/.cpp
1162 has been improved (e.g. renamed sieveIndex to multipleIndex).
1163 6. PreSieve now initializes its preSieved_ array using a 2nd wheel
1164 (modulo 6), up to 40 percent faster.
1165 7. I introduced a 'loopLimit' variable in EratSmall that saves some
1166 calculations and reduces the code size.
1167 8. Added a testFlags(uint32_t) convenience function to PrimeSieve.
1168 9. EratMedium has been simplified, it runs faster than v. 3.1 using
1169 Intel C++ 12.0 but slightly slower with most other compilers.
1170
1171 Changes in version 3.1, 24/10/2011
1172 ==================================
1173
1174 1. EratBig::sieve(uint8_t*) now processes multiple sieving primes per
1175 iteration, I measured a speed up of about 6 percent near 1E18.
1176 2. STL containers are now used instead of dynamic memory allocation in
1177 Erat(Small|Medium) which improves multi-threading performance ~ 3%.
1178 3. The Bucket data structure (WheelFactorization.h) has been modified
1179 and it performs well now with more compilers.
1180 4. EratMedium has been simplifed, the new code is far easier to
1181 understand and it is faster with the GNU g++ compiler.
1182 5. Fixed an integer overflow bug in EratMedium.cpp (see BUGS file).
1183 6. The -test option (primesieve console) has been reviewed.
1184 7. I improved the code readability and code documentation, the README
1185 and INSTALL files have also been revised.
1186
1187 Changes in version 3.0, 09/07/2011
1188 ==================================
1189
1190 1. The source code is now licensed under the New BSD License
1191 (previously GPL).
1192 2. The source code is now standard C++03 and ISO C99 (stdint.h), i.e.
1193 I removed all compiler intrinsics and built-in functions:
1194 80386 BSF, cpuid, SSE4.2 POPCNT.
1195 3. The thread scheduling of ParallelPrimeSieve has been improved,
1196 10 percent speed up.
1197 4. Prime numbers are now generated using bitScanForward() instead of
1198 lookup tables, 10 percent speed up.
1199 5. Implemented a fast bit population count function, see
1200 popcount_lauradoux() in bithacks.h.
1201 6. Revised the option handling in the console version of primesieve,
1202 added two new options: -o<OFFSET> and -r<PRE-SIEVE>
1203 7. README has been rewritten from scratch.
1204 8. Improved the code readability and revised the comments of the sieve
1205 of Eratosthenes implementation.
1206 9. ResetSieve has been renamed to PreSieve.
1207
1208 Changes in version 2.2, 26/05/2011
1209 ==================================
1210
1211 1. Added the file docs/EXAMPLES which shows how to use
1212 PrimeSieve and ParallelPrimeSieve objects.
1213 2. Fixed 4 minor bugs (see BUGS).
1214 3. 10% initialization speedup due to enhancement in
1215 ModuloWheel::setWheelPrime(uint64_t, uint32_t*, uint32_t*, uint32_t*)
1216 4. Added prime number generation functions and a convenience function
1217 to count prime numbers to PrimeSieve.
1218 5. The thread interface of ParallelPrimeSieve has been simplified.
1219 6. The code now compiles and runs with the sunCC compiler.
1220 7. The code readability has been improved.
1221 8. The documentation has been updated.
1222
1223 Changes in version 2.1, 11/04/2011
1224 ==================================
1225
1226 1. Fixed a start number bug (read doc/BUGS).
1227 2. Now supports integer arithmetic expressions as number input.
1228 3. Uses OpenMP instead of processes.
1229 4. Added qt-gui/README file.
1230 5. Fixed a bug in the Makefile (clang++ compiler).
1231 6. Updated the README file.
1232
1233 Changes in version 2.0, 15/02/2011
1234 ==================================
1235
1236 1. Added soe/ParallelPrimeSieve.cpp which counts primes in parallel
1237 using OpenMP.
1238 2. Added an arithmetic expression parser (./expr) to ease number input.
1239 3. Added a test suite to the console version of primesieve
1240 (option: -test) which runs various correctness tests.
1241 4. The console version has been reviewed and is first released.
1242 5. Fixed a minor bug in soe/PrimeNumberFinder.cpp which counts and
1243 prints the prime preceding the start number (see BUGS file).
1244 6. Improved the memory pool of soe/EratBig.cpp, primesieve 1.0 ran
1245 into trouble when sieving near 2^64.
1246 7. Makefile modified to better support GCC compatible compilers,
1247 e.g. make CXX=x86_64-w64-mingw32-g++