archive: remove pgzip, use gzip from go std lib (MR 25)
This replaces the parallel gzip with the boring gzip from Go's standard lib. The main motivations for doing this are: 1) Reduce runtime memory requirements 2) shed some external dependencies There's obviously a trade-off with compression speed/time (as seen below), but I feel like it's a worthwhile trade-off. Note that there's likely very little impact to boot performance wrt extracting these archives, the compression levels are similar. Measured on a Shift 6mq, which is a very fast phone... ** compress/gzip: User time (seconds): 1.81 System time (seconds): 0.38 Percent of CPU this job got: 104% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:02.09 Maximum resident set size (kbytes): 62024 -rw-r--r-- 1 clayton clayton 6.1M Sep 20 17:20 initramfs -rw-r--r-- 1 clayton clayton 2.5M Sep 20 17:20 initramfs-extra ** pgzip: User time (seconds): 1.19 System time (seconds): 0.48 Percent of CPU this job got: 159% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:01.05 Maximum resident set size (kbytes): 109952 -rw-r--r-- 1 clayton clayton 6.8M Sep 20 17:20 initramfs -rw-r--r-- 1 clayton clayton 2.8M Sep 20 17:20 initramfs-extra inspired by: https://gitlab.com/postmarketOS/pmaports/-/issues/1704
This commit is contained in:
@@ -5,7 +5,7 @@ package archive
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/flate"
|
||||
"compress/gzip"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
@@ -17,7 +17,6 @@ import (
|
||||
"syscall"
|
||||
|
||||
"github.com/cavaliercoder/go-cpio"
|
||||
"github.com/klauspost/pgzip"
|
||||
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/filelist"
|
||||
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/osutil"
|
||||
)
|
||||
@@ -222,10 +221,7 @@ func (archive *Archive) writeCompressed(path string, mode os.FileMode) error {
|
||||
return err
|
||||
}
|
||||
|
||||
gz, err := pgzip.NewWriterLevel(fd, flate.BestSpeed)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
gz := gzip.NewWriter(fd)
|
||||
|
||||
if _, err = io.Copy(gz, archive.buf); err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user