• Brad Fitzpatrick's avatar
    bufio: make Reader buffer transient · b25a53ac
    Brad Fitzpatrick authored
    Share garbage between different bufio Readers. When a Reader
    has zero buffered data, put its buffer into a pool.
    
    This acknowledges that most bufio.Readers eventually get
    read to completion, and their buffers are then no longer
    needed.
    
    benchmark               old ns/op    new ns/op    delta
    BenchmarkReaderEmpty         2993         1058  -64.65%
    
    benchmark              old allocs   new allocs    delta
    BenchmarkReaderEmpty            3            2  -33.33%
    
    benchmark               old bytes    new bytes    delta
    BenchmarkReaderEmpty         4278          133  -96.89%
    
    Update #5100
    
    R=r
    CC=adg, dvyukov, gobot, golang-dev, rogpeppe
    https://golang.org/cl/8819049
    b25a53ac
Name
Last commit
Last update
..
bufio.go Loading commit data...
bufio_test.go Loading commit data...
example_test.go Loading commit data...
export_test.go Loading commit data...
scan.go Loading commit data...
scan_test.go Loading commit data...