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/dashboard/processes.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/dashboard/processes.go')
| -rw-r--r-- | internal/tui/dashboard/processes.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/internal/tui/dashboard/processes.go b/internal/tui/dashboard/processes.go index 34fdbc8..f4eedec 100644 --- a/internal/tui/dashboard/processes.go +++ b/internal/tui/dashboard/processes.go @@ -42,7 +42,11 @@ func renderProcessesWithSort(snap *statsengine.Snapshot, width, height, offset, columns := processColumns() out := renderSelectableTable(columns, rows, height, offset, selectedCol, "enter:filter", "s/S:sort", processSortHint(sortState), "v:mode", "b:metric") if pidFilter > 0 { - out += "\n" + "Note: this tab is most useful with All PIDs." + // Use a Builder to avoid an extra allocation for the PID-filter note suffix. + var b strings.Builder + b.WriteString(out) + b.WriteString("\nNote: this tab is most useful with All PIDs.") + return b.String() } return out } |
