Skip to content

Reduce default registry lookup allocations - #39

Merged
andrew merged 1 commit into
mainfrom
bench/resolved-registry-urls
Sep 14, 2026
Merged

andrew merged 1 commit into
mainfrom
bench/resolved-registry-urls

Conversation

@andrew

@andrew andrew commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Reuse parsed default-registry hostnames and avoid allocating a configuration copy for each registry check. This benefits PURL types with configured default registries while preserving caller URL parsing and changes made through TypeInfo.

Registry checks drop from 368 bytes and three allocations to 144 bytes and one allocation. In the mixed npm tarball benchmark, full PURL construction allocates 36% fewer bytes.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No unresolved issues block approval.

Pull request overview

Reduces default registry lookup allocations by caching parsed hostnames while preserving TypeInfo mutation behavior.

Changes:

  • Cache parsed default registry hosts.
  • Avoid per-check configuration copies.
  • Add compatibility tests and benchmarks.
File summaries
File Summary
types.go Builds the default-host cache.
makepurl_bench_test.go Adds construction and allocation benchmarks.
defaults.go Uses cached hosts with mutation-safe fallback logic.
defaults_cache_test.go Tests registry semantics and compatibility.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@andrew
andrew merged commit e98a7e2 into main Sep 14, 2026
7 checks passed
@andrew
andrew deleted the bench/resolved-registry-urls branch September 14, 2026 03:12
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.

2 participants