Re: [go-nuts] Writing a non-blocking thread-safe buffer

2017-04-10 Thread Eno Compton
Thanks for all your responses, folks. I'm curious about swapping to a single channel and will try that. On Friday, April 7, 2017 at 4:37:10 PM UTC-6, John Souvestre wrote: > > A few ideas… > > > > Instead of using two channels, use just one. Let the writer(s) use a > “select” to do the write,

RE: [go-nuts] Writing a non-blocking thread-safe buffer

2017-04-07 Thread John Souvestre
A few ideas… Instead of using two channels, use just one. Let the writer(s) use a “select” to do the write, else default to doing a read (then loop to try the write again). I believe that would accomplish what you are doing now but with less overhead. I think that it’s great that you i

Re: [go-nuts] Writing a non-blocking thread-safe buffer

2017-04-07 Thread Michael Jones
I get about 3 million channel transfers per second on my computer. If each transfer is a single byte, that's 3 MB/sec. If transfers are pointers to buffers of a kilobyte, then that's 3 GB/sec...which is about as many bytes/sec as a CPU could possibly touch. If those buffers are 25kb then you're at