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