aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/declextract
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-12-12 15:10:26 +0100
committerDmitry Vyukov <dvyukov@google.com>2024-12-12 15:03:51 +0000
commit7ab3e22624058d5d53f9de8291031344a8d09cc2 (patch)
treecfde68428be9efea0ebe869c37e3e1f625000f9a /pkg/declextract
parent1cc680471dc68c265d7dd55f80ef7a1de48fa63f (diff)
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).
Diffstat (limited to 'pkg/declextract')
-rw-r--r--pkg/declextract/fileops.go6
1 files changed, 1 insertions, 5 deletions
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