Skip to content

[perf-scan] 2026-09-15 -- performance opportunities found #2981

Description

@github-actions

Performance Scan - 2026-09-15

Automated scan of src/apm_cli/ for algorithmic performance anti-patterns.
1 finding identified.

Findings

[F] Sequential independent I/O -- src/apm_cli/registry/operations.py:292-310

  • Current: O(n) sequential registry HTTP round-trips -- batch_fetch_server_info
    loops over server_references and calls
    self.registry_client.find_server_by_reference(server_ref) once per
    iteration, with no data dependency between iterations. Each call performs
    its own search_servers() + get_server() network request, so wall time
    grows linearly with server count. The sibling method
    check_servers_needing_installation (same class, lines 40-104) already
    solves the identical fan-out with a bounded ThreadPoolExecutor(max_workers=4),
    confirming this is an established, applicable pattern in this file.
  • Proposed: O(n/max_workers) wall time using the same bounded
    ThreadPoolExecutor approach already used a few dozen lines above in the
    same class.
  • Fix: Wrap the for server_ref in server_references: loop body in a
    ThreadPoolExecutor(max_workers=4) and use executor.map to fetch each
    server's info concurrently, mirroring check_servers_needing_installation's
    _check_one pattern, then populate server_info_cache from the results.

Scan coverage

  • src/apm_cli/ (484 files scanned)
  • Patterns checked: A (quadratic loops), B (linear scan in loop),
    C (unconditional expensive ops), D (redundant config parsing),
    E (heavy top-level imports), F (sequential independent I/O)

Generated by Daily Performance Scanner · copilot · auto · 112.2 AIC · ⌖ 6.03 AIC · ⊞ 10.1K · ◷

  • expires on Sep 22, 2026, 1:38 AM UTC

Activity

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

Metadata

Metadata

Labels

status/acceptedHuman scope approval; verify the issue's approval record and review contact before work.triage/recommendedAutomated advice completed; not human scope approval.type/automationAutomation script, workflow, gh-aw, dependabot config.type/performanceLatency, throughput, memory, install time.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions