On Fri, 30 Jan 2015 10:18:38 +0200 =?UTF-8?B?UMOpdGVyIFN6aWzDoWd5aQ==?= wrote:

Hey Bakul,

I've added your implementation to the shootout, but it's currently
panicing. Please investigate,
Can you Show me your shootout code that panics? I ran my
version on osx, freebsd and linux with no trouble. But I have
only tried this with os.Stdin, os.Stdout.
To the others too in general, I've openen a more formal proposal thread
(Subject: [proposal] bufio.Copy) in which various implementations and
discussions are going. I think we should move from this thread to that one
to keep it under a single thread of discussion and not multiplex between

Cheers :),
On Fri, Jan 30, 2015 at 12:16 AM, Bakul Shah wrote:

What about something like this: http://play.golang.org/p/g0-g6x-Kp_

The idea is to allocate a large buffer and read into it in
smaller chunks (at buffersize/N boundaries). For each read
chunk the reader sends its size in a chan. The writer waits
until it gets a valid count and writes it out and then sends
back an ack on another chan. The reader can be upto N reads
ahead of the writer. On a recent MBP I get about 2.9GB/s with

dd < /dev/zero bs=1m count=10000 | bufcopy > /dev/null

The sample interface in this quick hack is:

func bufcopy(w io.Writer, r io.Reader) error

Shouldn't be hard to turn it into what you want.
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 20 of 22 | next ›
Discussion Overview
groupgolang-nuts @
postedJan 28, '15 at 8:18a
activeJan 30, '15 at 1:02p



site design / logo © 2021 Grokbase