Skip to content

Remove allocations from SemVer scheme validation - #47

Merged
andrew merged 1 commit into
mainfrom
perf/semver-validation
Sep 14, 2026
Merged

andrew merged 1 commit into
mainfrom
perf/semver-validation

Conversation

@andrew

@andrew andrew commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Reuse the existing SemVer parser and iterate suffix identifiers without allocating regex matches or split slices. This preserves validation behavior for npm, semver, Cargo, Go, Hex, and Elixir.

Validating 1.2.3 drops from 192 bytes and two allocations to zero. Validation of prerelease and build identifiers also becomes allocation-free.

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 review issues were identified.

Pull request overview

This PR makes SemVer validation allocation-free while preserving existing behavior.

Changes:

  • Reuses parseSemverValue for validation.
  • Iterates prerelease and build identifiers without allocations.
  • Adds compatibility tests, fuzzing, and benchmarks.
File summaries
File Description
semver_validation_test.go Adds validation tests, fuzz coverage, and benchmarks.
normalization.go Implements allocation-free SemVer-like validation.
Review details
  • Files reviewed: 2/2 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 7de216c into main Sep 14, 2026
6 checks passed
@andrew
andrew deleted the perf/semver-validation branch September 14, 2026 02:01
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