I think the default was too large, so I'll lower it to 4 KiB from 32 KiB.
The new default sieves all primes <= 65535 on creation, i.e. the first 1900 primes.
Convenience init and failable main init
I'll add some culling options, which means that the main initializer must be allowed to fail. The reason being that the bit pattern cull must cull every values that are not on the wheel, meaning wheel <= culls. I'll add a parameterless init method that cannot fail because it picks all the defaults.
Time (s) to append primes up to 109 on a MacBook Pro, 13-inch, M1, 2020:
0.56 from 0.58 by using unsafe buffer pointers in hotspot.
0.52 from 0.56 by increasing the culls to x67 from x31.
Smaller default sieve
I think the default was too large, so I'll lower it to
4 KiB
from32 KiB
.Convenience init and failable main init
I'll add some culling options, which means that the main initializer must be allowed to fail. The reason being that the bit pattern cull must cull every values that are not on the wheel, meaning
wheel <= culls
. I'll add a parameterless init method that cannot fail because it picks all the defaults.Time (s) to append primes up to 109 on a MacBook Pro, 13-inch, M1, 2020:
0.56
from0.58
by using unsafe buffer pointers in hotspot.0.52
from0.56
by increasing theculls
tox67
fromx31
.