Skip to content

[Feature] Reduce CPU/RAM usage and binary size #63

@thangnm93

Description

@thangnm93

Problem Statement

A sweep of the codebase and release pipeline found avoidable runtime overhead and bundle dead weight:

  • Keyword-highlight rules were recompiled (one RegExp per rule) on every terminal build, with the same conversion chain duplicated across three widgets
  • SessionProvider.setActive notified the whole tree even when re-clicking the already-active tab
  • SSH agent messages were built with double list spreads in the auth hot path
  • local_auth was declared but never imported anywhere, pulling native plugins into the macOS/Windows bundles
  • MesloLGS NF shipped 4 faces (~9.8 MB of the 11 MB font folder); italic faces are rarely hit in terminals
  • Release builds shipped Dart debug symbols inside the AOT snapshot

Proposed Solution

  • Memoize compiled xterm keyword rules in SettingsProvider (cache keyed on rules-list identity + the enabled flag; rules are only ever replaced wholesale)
  • Equality guard in setActive
  • Build agent messages with a direct buffer write
  • Drop the unused local_auth dependency
  • Drop MesloLGS NF Italic / Bold Italic (−4.8 MB per bundle; the engine falls back to a synthetic slant)
  • --split-debug-info on all desktop release builds, with per-platform symbols zips attached to each release (flutter symbolize -d <symbols> to read crash traces)

Alternatives Considered

  • --obfuscate on top of split-debug-info — minimal extra size win, complicates every crash report; skipped
  • Dropping the smaller Powerline fonts (~1.3 MB) — they are user-selectable font options; removing them is a feature regression for little gain
  • Demand-driven SOCKS connection polling — rejected after verification: PortForwardProvider.setConnections already equality-guards, so the idle 2 s sample is negligible

Additional Context

Implemented in #61. Several findings from the initial scan were rejected after code verification (recording buffer is already bounded by the 500 ms flush timer; the suspected RDP listener leak is held by the session and GC'd with it).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions