4 ms·
I recently delved into Prime Number computation algorithms, and found that the fastest algorithm was outlined by the primesieve.org project: http://primesieve.o
by caleblloyd 11y ago
I recently delved into Prime Number computation algorithms, and found that the fastest algorithm was outlined by the primesieve.org project: http://primesieve.org/segmented_sieve.html http://primesieve.org/segmented_sieve.html
Their algorithm optimizes around L1 cache size. I'm not sure of the L1 cache size on Apple's SOCs, but to my knowledge Intel has been using 32KB for a while. It'd be cool to see the primesieve.org algorithm on these devices optimized for their respective L1 cache sizes.
I took a stab at converting their algorithm to a Go program, but primesieve.org's C version still runs orders of magnitude faster.
My Go Program and times: https://github.com/caleblloyd/primesieve https://github.com/caleblloyd/primesieve
Primesieve.org published times: http://primesieve.org/ http://primesieve.org/
EDIT: If you have any performance suggestions for my Go version of primesieve, I've opened an Ask HN thread: https://news.ycombinator.com/item?id=11413827 https://news.ycombinator.com/item?id=11413827