Skip to content

Reduce discovery latency and structured output allocations - #35

Open
ncode wants to merge 5 commits into
mainfrom
perf/discovery-hotpaths
Open

ncode wants to merge 5 commits into
mainfrom
perf/discovery-hotpaths

Conversation

@ncode

@ncode ncode commented Dec 1, 2026

Copy link
Copy Markdown
Owner

What changed

Five commits reduce the cost of fact discovery and structured output. Each commit includes its archived OpenSpec proposal.

  • Limit precedence updates to descendants of the replaced fact.
  • Skip unrelated probes for eligible OS name, hostname, and rooted wildcard queries. Preserve complete values when required by snapshots, overrides, or cache writes.
  • Select and batch Windows package and DMI probes, retaining independent fallback when a batch fails.
  • Reuse EC2 token negotiation within a single discovery.
  • Reduce allocations when decoding ordinary JSON-shaped values and rendering legacy text.

Measured impact

Workload Baseline PR
Replace 4,096 fact subtrees 385 ms 3.42 ms
macOS ARM64 CLI querying os.name 250 ms 4.58 ms
Linux amd64 CLI querying networking.hostname 61.4 ms 2.08 ms
Windows amd64 full discovery 7.11 s 5.60 s
Linux ARM64 legacy output, 1,024 rows 2.67 ms 1.15 ms

A 24-pair macOS control found no clear change in full-discovery latency.

Verification

Go tests, targeted race checks, vet, build, and strict OpenSpec validation passed. Both revisions cross-built for all 17 distribution targets. Runtime checks covered 15 of those targets, plus Plan 9 amd64 and Linux ARMv7. Intel macOS and Windows ARM64 received build-only coverage.

The FreeBSD ARMv7 release gate failed on both revisions because it requires non-null DMI on a system without SMBIOS data. The baseline and PR returned the same identity facts, and every other gate assertion passed.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant