From da07505f2b87b144347aa19597979d340b134b06 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 9 Apr 2024 09:02:58 +0200 Subject: pkg/cover: don't memorize all coverage points twice Currently we memorize all coverage points twice: as a slice and as a map. The map also contains __sanitizer_cov_trace_cmp PCs, but I think that's wrong, it should contain only __sanitizer_cov_trace_pc callbacks. We were careful to put as least pressure on the GC as possible by keeping all PCs as a dense allCoverPoints slice and subslicing it in all symbol/compilation unit objects. Don't duplicate coverage points in the map and just use the same slice we store for other purposes. --- pkg/cover/html.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkg/cover/html.go') diff --git a/pkg/cover/html.go b/pkg/cover/html.go index 6e266ebce..319a61ddd 100644 --- a/pkg/cover/html.go +++ b/pkg/cover/html.go @@ -225,8 +225,8 @@ type CoverageInfo struct { // DoCoverJSONL is a handler for "/cover?jsonl=1". func (rg *ReportGenerator) DoCoverJSONL(w io.Writer, params CoverHandlerParams) error { - if rg.CoverageCallbackPoints != nil { - if err := rg.symbolizePCs(rg.CoverageCallbackPoints); err != nil { + if rg.CallbackPoints != nil { + if err := rg.symbolizePCs(rg.CallbackPoints); err != nil { return fmt.Errorf("failed to symbolize PCs(): %w", err) } } -- cgit mrf-deployment