-
Notifications
You must be signed in to change notification settings - Fork 122
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
Alternative Go version #27
Comments
I'm not implying that my version should be used instead of the one repo has. I just wrote it out of curiosity and sharing it here. |
@nsf Awesome! Thanks for sharing it with everyone. I wasn't trying to attack, just wanted to clarify and help improve the benchmark. |
Also you might want to include language versions in benchmark results |
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
start := time.Now()
var wg sync.WaitGroup
wg.Add(1)
var result int
go skynet(&result, 0, 1000000, 10, &wg)
wg.Wait()
took := time.Since(start)
fmt.Printf("Result: %d in %d ms.\n", result, took.Nanoseconds()/1e6)
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just in case if you're curious. It avoids using channels for communications and uses sync.WaitGroup instead. Results are collected via arrays and then aggregated inside a single goroutine. On my machine it's slightly faster than channel-based one.
The text was updated successfully, but these errors were encountered: