Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Reimplementation] Sieve of eratosthenes #722

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ddaniel27
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant