Skip to content

perf: cold-start time audit — measure and reduce time-to-first-prompt #325

@Hmbown

Description

@Hmbown

Problem

Time-to-first-prompt (TTFP) — from deepseek invocation to interactive cursor — is a first-impression metric. Slow startup hurts adoption. Today TTFP isn't measured.

Proposed solution

  1. Measure. Add a --print-startup-trace debug flag that emits timestamps for every initialization step:

    • process exec
    • clap parse
    • config load
    • keyring probe
    • MCP server connect (if enabled)
    • skill discovery
    • terminal init / alt-screen enter
    • first render
  2. Profile a cold launch on each platform. Linux x64, macOS arm64, Windows x64. Different bottlenecks.

  3. Optimize the obvious:

    • Lazy keyring probe — don't talk to the OS keyring unless the active provider has no env-var key. Today we probe all 4 providers regardless.
    • Lazy MCP connect — defer MCP server connections to first tool-use, not startup. Saves the connect timeout × N when MCP is configured but unused this session.
    • Lazy skill discovery — don't fs::read_dir ~/.deepseek/skills/ unless /skill or /skills is invoked.
    • Strip release binary — verify [profile.release] strip = true in Cargo.toml. (Possibly already done.)

Acceptance criteria

  • --print-startup-trace flag.
  • Baseline measurement on a clean install (Linux + macOS at minimum) committed to docs/perf.md.
  • At least one optimization landed with before/after numbers.
  • TTFP target on macOS arm64: < 200ms cold, < 50ms warm.

Related

  • crates/cli/src/lib.rs and crates/tui/src/main.rs — startup paths.
  • crates/tui/src/mcp.rs — MCP connect timing.
  • crates/tui/src/skills.rs — skill discovery.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions