-
Notifications
You must be signed in to change notification settings - Fork 11
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
What about buffered channels? #1
Comments
Thanks for the input. |
Also I'll explore extending the benchmarks. |
I'll do this issue only for inform 🙂 |
No worries at all. I really appreciate your feedback!! This is a brand new project and there's still a lot to improve upon. One thing to consider is that a fastlane channel uses an interface{} for it's value and in the benchmarks the Go channel uses an make(chan int). When changed to make(chan interface{}) the Go channels slow down quite a bit. And when I change the base value type for fastlane channels from interface{} to int, they speed up a lot. I'm considering creating a generator instead of requiring interface{}. |
So it’s much faster now. Check out the new benchmarks. |
@tidwall good job!
but.. I would add ReportAlloc() like this: func BenchmarkFastlaneChan(b *testing.B) {
b.ResetTimer()
b.ReportAllocs()
benchmarkFastlaneChan(b.N, false)
}
func BenchmarkGoChan100(b *testing.B) {
b.ResetTimer()
b.ReportAllocs()
benchmarkGoChan(b.N, 100, false)
}
func BenchmarkGoChan10(b *testing.B) {
b.ResetTimer()
b.ReportAllocs()
benchmarkGoChan(b.N, 10, false)
}
func BenchmarkGoChanUnbuffered(b *testing.B) {
b.ResetTimer()
b.ReportAllocs()
benchmarkGoChan(b.N, 0, false)
} |
@tidwall If you do not mind, I would like to make PR |
Super sorry, but I didn't see you last comment, and I pushed a change that includes |
nothing to worry about.. the main thing that is done 🙂 |
Oh... it's cool! you fix B/op 👍🏻 |
and with go1.10rc2 it's ≈1.5 faster than go-chan 🙂
|
@tidwall something strange with Go 1.10 and latest changes (Run from GoLand):
Run from command-line
|
What’s strange? |
this part
it slower than go-channels three times |
This is because you are using the |
oh.. thanks.. it my mistake |
No worries. 👍 |
Mb I do something wrong, but... what about buffered channels?
Looks like not so quick, like in your benchmarks...
The text was updated successfully, but these errors were encountered: