Skip to content
This repository was archived by the owner on Sep 22, 2026. It is now read-only.
This repository was archived by the owner on Sep 22, 2026. It is now read-only.

performance check: findings for azd-copilot #47

Description

@jongio

performance check

  • FindCopilotCLI() is called twice per invocation on the hot path - once by IsCopilotInstalled() and again inside Launch() - causing a redundant blocking npm config get prefix subprocess call on Windows whenever npm_config_prefix env var is absent (adds ~300-500ms startup latency). Fix: cache the result in a package-level variable with sync.Once, or return the found path from IsCopilotInstalled() so Launch() can reuse it.
  • assets.ListSkills() is called multiple times on every interactive startup with no caching: once in newRootCmd() via SkillCount(), and again in printBanner() - each call walks the embedded FS and parses YAML frontmatter for all ~30 skills from scratch. Same pattern applies to ListAgents(). Fix: cache the result with sync.Once at the package level since the embedded FS is immutable at runtime.
  • GetSkill(name) always calls ListSkills() to do a linear O(n) scan across all skills, causing full embedded-FS traversal and YAML parsing for every single-skill lookup. Fix: build a map[string]*SkillInfo once in a sync.Once initializer and use it for O(1) lookups.
  • The checkpoint index.json is read from disk independently by every checkpoint operation (Get, ListByType, Delete, KeepLatest, GetProjectFiles, SaveWithOptions), with no in-process cache. Each SaveWithOptions call reads the full index, appends one entry, and rewrites the entire file - making checkpoint saves O(n) in the number of checkpoints. Fix: add a session-lifetime in-memory cache for the index, invalidated on write.

Automated analysis - 4 finding(s)

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

    Labels

    automatedFiled by automated analysis

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions