Check-in [4f0d26907d]
Overview
Comment:Buffer the input on decompressing, not the decompressor itself. This takes pdc -d < linux-3.18.1.tar.pdc > linux-3.18.1.tar down to 11 seconds from 13 minutes :)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4f0d26907d45681fbfce5a00fdfbf39163e9fdc7
User & Date: spaskalev on 2014-12-20 17:44:14
Other Links: manifest | tags
Context
2014-12-21
01:59
Added a function that reverses the bits in a byte. Coverage: 100.0% of statements. check-in: 2be2ff6bf7 user: spaskalev tags: trunk
2014-12-20
17:44
Buffer the input on decompressing, not the decompressor itself. This takes pdc -d < linux-3.18.1.tar.pdc > linux-3.18.1.tar down to 11 seconds from 13 minutes :) check-in: 4f0d26907d user: spaskalev tags: trunk
13:04
Decompressor might loose part of the underlying buffer array by reslicing, fixed by copy check-in: d516e7425d user: spaskalev tags: trunk
Changes

Modified src/0dev.org/commands/pdc/main.go from [3c0c8016e1] to [c6f8b3fe28].

    53     53   
    54     54   // Decompress the data from the given io.Reader and write it to the given io.Writer
    55     55   // I/O is buffered for better performance
    56     56   func decompress(output io.Writer, input io.Reader) int {
    57     57   	var (
    58     58   		err          error
    59     59   		buffer       *bufio.Writer = bufio.NewWriter(output)
    60         -		decompressor io.Reader     = predictor.Decompressor(input)
           60  +		decompressor io.Reader     = predictor.Decompressor(bufio.NewReader(input))
    61     61   	)
    62     62   
    63         -	_, err = io.Copy(buffer, bufio.NewReader(decompressor))
           63  +	_, err = io.Copy(buffer, decompressor)
    64     64   	if err != nil {
    65     65   		fmt.Fprintln(os.Stderr, "Error while decompressing.\n", err)
    66     66   		return 1
    67     67   	}
    68     68   
    69     69   	// Flush
    70     70   	err = buffer.Flush()