On Tue, Nov 22, 2016 at 12:37 PM, Dave Cheney <d...@cheney.net> wrote:
> Thinking about this overnight I think this benchmark
>
> https://play.golang.org/p/5d4MUKqPYd
>
> Shows the issue you are having. On my machine
>
> % go test -bench=. -benchtime=5s
> BenchmarkWithoutLockOSThread-4 5000 1827196 ns/op
> BenchmarkWithLockOSThread-4 200 31506649 ns/op
>
> My guess is the LockOSThread version causes a context switch because the
> thread the sending goroutine runs on must be parked, and the receiving
> thread locked to the receiving goroutine must be woken to drain the value.
>
> I don't see an easy workaround for this slowdown.

I also have come to think it may be due to thread context switching.

Still, I also wrote up a benchmark, and I filed https://golang.org/issue/18023.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to