microsoft / microsoft/apm

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

Open
#2,981 1 comment 0 reactions 1 assignee View on GitHub

@sergio-sisternes-epam is already working on this.

Since Sep 15, 2026.

status/accepted type/automation type/performance
Dominant language
Python
Stars
3.9k
Forks
365
Avg merge
1d 17h
Merged PRs (30d)
132

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.