Go
Go copied to clipboard
[Reimplementation] Sieve of eratosthenes
This is a reimplementation for the algorithm sieve of erathosthenes, this reimplementation doesn't use channels and has a better performance than the actual sieve in the repository.
Benchmarks for limit=10000
Current implementation:
goos: linux
goarch: amd64
pkg: github.com/TheAlgorithms/Go/math/prime
cpu: AMD Ryzen 5 5600G with Radeon Graphics
BenchmarkSieve10-12 1 3019938961 ns/op 7515624 B/op 40073 allocs/op
PASS
ok github.com/TheAlgorithms/Go/math/prime 3.206s
My implementation:
goos: linux
goarch: amd64
pkg: github.com/TheAlgorithms/Go/math/prime
cpu: AMD Ryzen 5 5600G with Radeon Graphics
BenchmarkSieveEratosthenes-12 45400 27502 ns/op 107129 B/op 13 allocs/op
PASS
ok github.com/TheAlgorithms/Go/math/prime 1.707s