Potential workaround for poor zstd performance
Performance is still not great, but better
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package squashfs
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/CalebQ42/squashfs/internal/toreader"
|
||||
)
|
||||
|
||||
type fragEntry struct {
|
||||
Start uint64
|
||||
Size uint32
|
||||
_ uint32
|
||||
}
|
||||
|
||||
func (r Reader) fragReader(index uint32) (io.Reader, error) {
|
||||
realSize := r.fragEntries[index].Size &^ (1 << 24)
|
||||
rdr := io.LimitReader(toreader.NewReader(r.r, int64(r.fragEntries[index].Start)), int64(realSize))
|
||||
if realSize != r.fragEntries[index].Size {
|
||||
return rdr, nil
|
||||
}
|
||||
return r.d.Reader(rdr)
|
||||
}
|
||||
Reference in New Issue
Block a user