Potential workaround for poor zstd performance

Performance is still not great, but better
This commit is contained in:
Caleb Gardner
2022-06-21 01:09:33 -05:00
parent 1b934de04d
commit 83dfa77b7d
12 changed files with 110 additions and 30 deletions
+22
View File
@@ -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)
}