From 70393e5d05ae78166599755b835f0d465c815f48 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 25 Nov 2022 12:50:29 +0100 Subject: prog: don't materialize uncompressed image in Deserialize Currently we uncompress all images in Deserialize to check that the data is valid. As the result deserializing all seeds we have takes ~40 seconds of real time and ~125 seconds of CPU time. And we do this during every syz-manager start. Don't materialize the uncompressed image. This reduces real time to ~15 seconds and CPU time to 18 seconds (no garbage collections). In syz-manager the benefit is even larger since garbage collections take longer (larger heap). --- sys/linux/init_images.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/linux') diff --git a/sys/linux/init_images.go b/sys/linux/init_images.go index 0284f9190..8b62455d2 100644 --- a/sys/linux/init_images.go +++ b/sys/linux/init_images.go @@ -24,11 +24,11 @@ func (arch *arch) extractSyzMountImage(c *prog.Call) (io.Reader, error) { } else if len(data) == 0 { return nil, fmt.Errorf("an empty image") } - decompressedData, err := prog.Decompress(data) - if err != nil { + buf := new(bytes.Buffer) + if err := prog.DecompressWriter(buf, data); err != nil { return nil, err } - return bytes.NewReader(decompressedData), nil + return buf, nil } func (arch *arch) fixUpSyzMountImage(c *prog.Call, fixStructure bool) error { -- cgit mrf-deployment