From 61a79c6928024a157b9d02451ab3e4ba75ea1bf1 Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Thu, 5 Dec 2024 18:11:19 -0800 Subject: [PATCH] Bail out fast when no demangling is requested (#915) * Bail out fast when no demangling is requested Avoid trying to demangle functions one by one; besides, `demangleSingleFunction` doesn't quite behave correctly when **no** demangling is requested. * s/bail/Bail --------- Co-authored-by: Alexey Alexandrov --- internal/symbolizer/symbolizer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/symbolizer/symbolizer.go b/internal/symbolizer/symbolizer.go index 0d451364..fd6e015a 100644 --- a/internal/symbolizer/symbolizer.go +++ b/internal/symbolizer/symbolizer.go @@ -257,6 +257,10 @@ func Demangle(prof *profile.Profile, force bool, demanglerMode string) { } options := demanglerModeToOptions(demanglerMode) + // Bail out fast to avoid any parsing, if we really don't want any demangling. + if len(options) == 0 { + return + } for _, fn := range prof.Function { demangleSingleFunction(fn, options) }