diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-13 14:41:18 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-13 14:41:18 +0300 |
| commit | d392eebe5bd127e1573734321b0cabaad4182d7c (patch) | |
| tree | e6e0b38ba26110411d80e00b224640c26b8110ae /internal/tui/help.go | |
| parent | de6b9c4741dea87ce66e0309bac580030490dc30 (diff) | |
perf: replace string += concatenation with strings.Builder in TUI render hot paths
Swap out ad-hoc += string concatenation in the flamegraph toolbar/status
lines, dashboard filter summary, bubble/treemap status lines, eventstream
view, processes tab, and probes list for strings.Builder, eliminating
redundant allocations on every render tick. Also update dashboard/model_test.go
fake SnapshotSource implementations to match the updated interface signature.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/tui/help.go')
| -rw-r--r-- | internal/tui/help.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/internal/tui/help.go b/internal/tui/help.go index ba4ed02..5a343cb 100644 --- a/internal/tui/help.go +++ b/internal/tui/help.go @@ -47,12 +47,18 @@ type helpSection struct { } func (m Model) helpSections() []helpSection { + line1 := "f filter p pid picker t tid picker o probes R parquet rec" + if help := m.keys.Export.Help(); help.Key != "" || help.Desc != "" { + // Use a Builder to append the optional export hint without reallocating + // the base string on each render when help is visible. + var b strings.Builder + b.WriteString(line1) + b.WriteString(" e stream export") + line1 = b.String() + } globalLines := []string{ "H help esc/? close help q quit", - "f filter p pid picker t tid picker o probes R parquet rec", - } - if help := m.keys.Export.Help(); help.Key != "" || help.Desc != "" { - globalLines[1] += " e stream export" + line1, } return []helpSection{ |
