Skip to content

Reuse the captured environment for platform theme fallback #347

Description

@stalep

Review of terminal-detect, terminal-api, and terminal-tty at 859020a6 on 2026-09-28.

Review item: Performance 3
Priority: P2
Evidence: Repeated detector construction confirmed; end-to-end savings not measured.

Problem / scope

Full detection constructs a TerminalDetector, then detectPlatformTheme()
constructs another one instead of using the captured environment. On Windows
this can repeat registry-based terminal identity subprocesses. It also discards
the injected environment used by a caller/test detector.

Source at the reviewed commit

Acceptance criteria

  • Reuse the current detector/environment for config and OS theme fallback.
  • Count identity subprocess invocations in a fixture and test that the original environment is retained.
  • Measure complete startup detection before/after; keep claims separate from environment-only microbenchmarks.

Tracking

Part of #300. Related: #293, #297.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions