Overview
| Comment: | Removed pdc's output buffer when decompressing as io.Copy uses a sufficiently-large buffer internally. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
2b1ed8e45e9dcc2474d875144b95085f |
| User & Date: | spaskalev on 2014-12-25 01:25:56.578 |
| Other Links: | manifest | tags |
Context
|
2014-12-25
| ||
| 08:48 | Allocate the predictor's decompression buffer per Read call. check-in: f06f8cd058 user: spaskalev tags: trunk | |
| 01:25 | Removed pdc's output buffer when decompressing as io.Copy uses a sufficiently-large buffer internally. check-in: 2b1ed8e45e user: spaskalev tags: trunk | |
| 00:55 | Predictor's compressor and decompressor structures now implement io.Writer/io.Reader in order to deal away with function indirection but they do not follow the required semantics. Those are provided by the SizedWriter/SizedReader wrappers returned by the constructor functions. check-in: 4dfcff962c user: spaskalev tags: trunk | |
Changes
Modified src/0dev.org/commands/pdc/main.go
from [dfe0b7b6cf]
to [9aabc03cac].
| ︙ | ︙ | |||
54 55 56 57 58 59 60 |
}
// Decompress the data from the given io.Reader and write it to the given io.Writer
// I/O is buffered for better performance
func decompress(output io.Writer, input io.Reader) int {
var (
err error
| < | < < < < < < < | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
}
// Decompress the data from the given io.Reader and write it to the given io.Writer
// I/O is buffered for better performance
func decompress(output io.Writer, input io.Reader) int {
var (
err error
decompressor io.Reader = predictor.Decompressor(iou.SizedReader(input, 4096))
)
_, err = io.Copy(output, decompressor)
if err != nil {
fmt.Fprintln(os.Stderr, "Error while decompressing.\n", err)
return 1
}
return 0
}
|