Skip to content

Reduce allocations in Composer, NuGet, Go and Python parsers - #96

Merged
andrew merged 2 commits into
mainfrom
perf/manifest-line-iteration
Sep 14, 2026
Merged

andrew merged 2 commits into
mainfrom
perf/manifest-line-iteration

Conversation

@andrew

@andrew andrew commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Preallocate dependency slices in Composer and NuGet lockfile parsers, and use strings.SplitSeq in Go, Python and Paket parsers to avoid allocating a slice of every line. Preserve empty results, package filtering and deduplication across target frameworks.

Public Parse benchmarks show 26% fewer allocated bytes for the Composer fixture and 5–43% fewer for NuGet fixtures. Synthetic lockfiles with 10,000 dependencies use 43–63% fewer bytes. Line iteration saves another 0.6–1.4% in the six affected line-based formats.

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

The reviewed changes preserve behavior and have no unresolved blocking issues.

Pull request overview

Reduces allocations in Composer, NuGet, Go, and Python parsers while preserving parsing behavior.

Changes:

  • Preallocates Composer and NuGet dependency slices.
  • Uses strings.SplitSeq for line-based parsers.
  • Adds regression tests and allocation benchmarks.
File summaries
File Description
lock_capacity_test.go Adds capacity tests and benchmarks.
line_iteration_test.go Adds line-ending tests and benchmarks.
internal/pypi/pypi.go Uses iterator-based line parsing.
internal/nuget/nuget.go Preallocates dependencies and uses SplitSeq.
internal/golang/golang.go Uses iterator-based line parsing.
internal/composer/composer.go Preallocates Composer dependencies.
Review details
  • Files reviewed: 6/6 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 498e486 into main Sep 14, 2026
4 checks passed
@andrew
andrew deleted the perf/manifest-line-iteration branch September 14, 2026 02:51
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