Repository navigation
Compare PyPI versions without allocating component slices - #68
Conversation
Scan ASCII PEP 440 components and walk release and local labels in place. Keep the regexp path for Unicode case-folding compatibility.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Addresses the PyPI item in #31. The other comparators are unchanged.
For ASCII PEP 440 versions, the parser keeps the release and local labels as views into the input instead of allocating regexp captures and component lists. Comparisons walk the components in place. Non-ASCII inputs still use the original regexp to preserve its Unicode case folding (e.g. a Kelvin sign in a local label). Invalid versions still fall back to generic comparison.
Median of five runs of
BenchmarkPyPIComparisonon darwin/arm64, Apple M1 Pro, Go 1.26.7,GOMAXPROCS=2, 200 ms per sample:The allocation test failed on the unmodified base at 6/6/11 allocations and passes here. Added differential ordering tests against the regexp/split implementation, including invalid versions, Unicode and 1,050 suffix combinations. With the upstream fixtures checked out,
go build ./...,go vet ./...,go test -race ./..., a 20-second differential fuzz run, andgolangci-lint run ./...passed locally. Other platforms were not run locally.AI assistance: OpenAI Codex (GPT-6.2 Astra) implemented this change and its tests, ran the checks and benchmarks, and drafted this description.
Summary by CodeRabbit