Further performance improvements

Further removed multiple pointer instances
Re-use decompression readers (except zstd due to bugs)
This commit is contained in:
Caleb Gardner
2025-04-10 11:20:55 -05:00
parent 6b0e9ef2c6
commit 6224c4be41
11 changed files with 66 additions and 36 deletions
+5 -5
View File
@@ -17,7 +17,7 @@ import (
const (
squashfsURL = "https://darkstorm.tech/files/LinuxPATest.sfs"
squashfsName = "LinuxPATest.sfs"
squashfsName = "tensorflow.sqfs"
)
func preTest(dir string) (fil *os.File, err error) {
@@ -111,7 +111,7 @@ func BenchmarkRace(b *testing.B) {
b.Fatal(err)
}
libTime = time.Since(start)
cmd := exec.Command("unsquashfs", "-d", unsquashPath, fil.Name())
cmd := exec.Command("unsquashfs", "-q", "-d", unsquashPath, fil.Name())
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
start = time.Now()
@@ -187,7 +187,7 @@ func TestExtractQuick(t *testing.T) {
}
}
var filePath = "Start.exe"
var filePath = "usr/sbin/add-shell"
func TestSingleFile(t *testing.T) {
tmpDir := "testing"
@@ -195,7 +195,7 @@ func TestSingleFile(t *testing.T) {
if err != nil {
t.Fatal(err)
}
os.Remove(filepath.Join(tmpDir, filePath))
os.RemoveAll("testing/stuff")
rdr, err := NewReader(fil)
if err != nil {
t.Fatal(err)
@@ -206,7 +206,7 @@ func TestSingleFile(t *testing.T) {
}
op := DefaultOptions()
op.Verbose = true
err = f.(*File).ExtractWithOptions("testing", op)
err = f.(*File).ExtractWithOptions("testing/stuff", op)
if err != nil {
t.Fatal(err)
}