Skip to content
Permalink
Browse files

Update libprimesieve performance tips

  • Loading branch information
kimwalisch committed Nov 28, 2019
1 parent 0b00a9f commit 93915c9295f76d7f6fd730c11491a71efe2bd124
Showing with 6 additions and 5 deletions.
  1. +6 −5 README.md
@@ -203,11 +203,12 @@ is relatively small e.g.&nbsp;<&nbsp;sqrt(start). If ```stop_hint``` is set
```primesieve::iterator``` will only buffer primes up to this limit.
* Many of libprimesieve's functions e.g. ```count_primes(start, stop)``` &
```nth_prime(n, start)``` incur an initialization overhead of about
O(sqrt(start)) even if the total sieving distance is tiny. It is therefore not
a good idea to call e.g. ```prime = nth_prime(1, prime)``` in a loop to iterate
over the primes. Use a ```primesieve::iterator``` instead to avoid the recurring
initialization overhead.
```nth_prime(n, start)``` incur an initialization overhead of O(sqrt(start))
even if the total sieving distance is tiny. It is therefore not a good idea to
call these functions repeatedly in a loop unless the sieving distance is
sufficiently large e.g. >&nbsp;sqrt(start). If the sieving distance is mostly
small consider using a ```primesieve::iterator``` instead to avoid the
recurring initialization overhead.
## Multi-threading

0 comments on commit 93915c9

Please sign in to comment.
You can’t perform that action at this time.