From 7ab3e22624058d5d53f9de8291031344a8d09cc2 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 12 Dec 2024 15:10:26 +0100 Subject: pkg/ifaceprobe: optimize cache Instead of storing real PC values store indexes into the PCs table. This significantly reduces size of the cache (in my case from 1823 MB to 473 MB) and actually makes use of the cache simpler (don't need separate map). --- pkg/declextract/fileops.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'pkg/declextract') diff --git a/pkg/declextract/fileops.go b/pkg/declextract/fileops.go index 78016d57b..d28c48337 100644 --- a/pkg/declextract/fileops.go +++ b/pkg/declextract/fileops.go @@ -89,10 +89,6 @@ func (ctx *context) mapFopsToFiles() map[*FileOps][]string { uniqueFuncs[fn]++ } } - pcToFunc := make(map[uint64]string) - for _, pc := range ctx.probe.PCs { - pcToFunc[pc.PC] = pc.Func - } // matchedFuncs holds functions are present in any file_operations callbacks // (lots of coverage is not related to any file_operations at all). matchedFuncs := make(map[string]bool) @@ -102,7 +98,7 @@ func (ctx *context) mapFopsToFiles() map[*FileOps][]string { funcs := make(map[string]bool) fileToFuncs[file.Name] = funcs for _, pc := range file.Cover { - fn := pcToFunc[pc] + fn := ctx.probe.PCs[pc].Func if len(funcToFops[fn]) != 0 { funcs[fn] = true matchedFuncs[fn] = true -- cgit mrf-deployment