From 3bdf1c5586d449bb17aa0373b45b5b3bbeedda46 Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Wed, 17 Jul 2024 10:23:12 +0200 Subject: syz-cover: cache subsystems to speed-up report generation --- pkg/cover/heatmap.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/cover/heatmap.go b/pkg/cover/heatmap.go index 2582de7d7..2b89c081b 100644 --- a/pkg/cover/heatmap.go +++ b/pkg/cover/heatmap.go @@ -182,9 +182,15 @@ func DoSubsystemsHeatMap(w io.Writer, projectID, ns string, dateFrom, dateTo civ panic(err) } ssMatcher := subsystem.MakePathMatcher(subsystem.GetList("linux")) + ssCache := make(map[string][]*subsystem.Subsystem) var ssCovAndDates []*fileCoverageAndDate for _, cad := range covAndDates { - for _, ss := range ssMatcher.Match(cad.Filepath) { + sss := ssCache[cad.Filepath] + if sss == nil { + sss = ssMatcher.Match(cad.Filepath) + ssCache[cad.Filepath] = sss + } + for _, ss := range sss { newRecord := fileCoverageAndDate{ Filepath: ss.Name + "/" + cad.Filepath, Instrumented: cad.Instrumented, -- cgit mrf-deployment