3 ms·
As a relative go newb, I do have a question about this: I thought channels/go routines were already essentially composable buffers. No?
by kenferry 12y ago
As a relative go newb, I do have a question about this: I thought channels/go routines were already essentially composable buffers. No?
- fishnchips 12y agoYes and no. Goroutines are lightweight threads - what other languages might call fibers. Channels are synchronisation primitives designed to work with goroutines but they do indeed provide some buffering. What OP is doing though is creating customisable buffers that allow you to control for memory usage and that are likely designed to replace things like bytes.Buffer rather then buffered channels. Of course I may be totally wrong ;)
- djherbis 12y agoYou've got the right idea. bytes.Buffer is great (I even use it under the hood) but this repo is intended to give you more control over how your buffer behaves as the amount of data stored in it changes.