JuliaMath / Primes.jl

Prime numbers in Julia
Other
99 stars 32 forks source link

faster prime sieve part 1 #120

Open oscardssmith opened 2 years ago

oscardssmith commented 2 years ago

Before _primesmask(2^30) took 2.726 seconds after it took 2.358s. Although this is a relatively small improvement overall, it removes ~100% of the time for the small primes (250ms vs 30ms) which means that this will continue to show large gains once we optimize the larger primes.

I've also separated sieving into it's own file since I expect the code will become more complex as we move to better sieves. @haampie since this is essentially part 1 of https://github.com/JuliaMath/Primes.jl/pull/87.