Skip to content

Reduce POM parsing and resolution allocations - #17

Merged
andrew merged 3 commits into
mainfrom
optimize-pom-parsing
Aug 14, 2026
Merged

Reduce POM parsing and resolution allocations#17
andrew merged 3 commits into
mainfrom
optimize-pom-parsing

Conversation

@andrew

@andrew andrew commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Reduce CPU time and allocations in POM parsing and effective-model resolution.

This adds a selective XML decoder for fields used by resolution, replaces regexp interpolation with a zero-allocation scanner for common expressions, and reduces temporary maps, slices, and dependency keys during inheritance and BOM merging. Resolver memoization now separates default, pessimistic, and BOM effective models so cached results keep profile semantics.

Adds offline benchmarks covering large POM parsing, deep parents, imported BOMs, repeated properties, dependency management, and multi-artifact resolver reuse.

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.

Pull request overview

This PR improves performance of Maven POM parsing and effective-model resolution by reducing allocations in hot paths (XML decoding, interpolation, and merge/resolution bookkeeping) while tightening resolver memoization semantics across profile modes and BOM imports.

Changes:

  • Introduces a selective XML decoder used by ParsePOM, with tests validating parity against encoding/xml decoding for fixture POMs and error cases.
  • Replaces regexp-based property interpolation with a scanner-based implementation and extends interpolation tests for additional edge cases.
  • Refactors resolver memoization to cache separate effective models for default, pessimistic, and BOM contexts; pre-sizes merger structures using parent-chain-derived capacities; adds offline benchmarks for large/deep resolution scenarios.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
resolver.go Splits cached models by profile/BOM semantics and reduces merger allocations via capacity planning and lower-overhead dependency profile tracking.
resolver_test.go Adds coverage ensuring cache separation across profile modes and BOM effective models.
pom.go Switches ParsePOM to use the new selective decoder while preserving existing size checks and XML decoder configuration.
pom_test.go Adds parity tests comparing the selective decoder to encoding/xml across fixtures, errors, and nested text behavior.
parse.go Implements the selective XML decoding logic for the subset of POM fields used by the resolver.
interpolate.go Replaces regexp interpolation with a pass-based scanner, including whole-string fast path and capped growth handling.
interpolate_test.go Extends interpolation tests to cover concatenated expressions and malformed/empty-expression edge cases.
bench_test.go Adds benchmarks targeting deep parents, BOM imports, repeated properties, dependency management, and multi-artifact resolver reuse.

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

@andrew
andrew merged commit d818a2c into main Aug 14, 2026
5 checks passed
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