Libraries

Implementations, measured.

The JavaScript reference implementation and its ports to Rust, Python, Go, Ruby, Java, .NET and PHP. All 8 pass the same 476-case conformance suite, give identical answers on every version and range in the benchmark corpus, and are timed against the libraries they replace on real versions and ranges from the npm registry.

At a glance

LanguagePackageConformanceCompared withSpeed vs. it
JavaScriptsemantic-versions476/476semver 396/4762.4–11×
Rustsemantic-versions476/476nodejs-semver 366/4760.9–1.3×
Pythonsemantic-versions476/476node-semver 366/4761.5–17×
Gosemver.xyz/go476/476Masterminds/semver 348/4362.8–23×
Rubysemantic-versions476/476semantic_range 366/4761.7–20×
Javaxyz.semver:semantic-versions476/476semver4j 356/4369.2–26×
.NETSemanticVersions476/476Semver 365/4361.3–10×
PHPvltpkg/semantic-versions476/476composer/semver 282/4361.0–3.7×

Conformance counts the cases each library passes in the shared suite (libraries that do not expose a desugared range are scored on the 413 cases that do not need one); speed is the range of speed-ups over the compared library across the operations below. Each language is measured in its own runtime on the same machine, so compare numbers within a language, not across languages. Method and raw results: benchmarks/.

Install

JavaScriptnpm

The reference implementation: plain ES2020 with zero dependencies, so it runs unchanged in Node, Deno, Bun, browsers and edge workers. It powers the range selector.

install
vlt install semantic-versions
Conformance
476/476
vs semver
2.4–11×
Rustcrates.io

No dependencies and no unsafe. A Version is 32 bytes, and plain releases parse without allocating.

install
cargo add semantic-versions
Conformance
476/476
vs nodejs-semver
0.9–1.3×
PythonPyPI

Pure Python 3.10+, typed, no dependencies. Versions order by a precomputed tuple, so sorting runs at C speed.

install
pip install semantic-versions
Conformance
476/476
vs node-semver
1.5–17×
Gopkg.go.dev

Standard library only. Versions are plain values whose identifiers are slices of the input, so parsing does not allocate.

install
go get semver.xyz/go
Conformance
476/476
vs Masterminds/semver
2.8–23×
RubyRubyGems

Plain Ruby 3.1+, no dependencies. Version is Comparable and Range works with case/when.

install
gem install semantic-versions
Conformance
476/476
vs semantic_range
1.7–20×
JavaMaven Central

Java 17+, no dependencies. Immutable, Comparable versions; works from Kotlin, Scala and every other JVM language.

pom.xml
<dependency>
  <groupId>xyz.semver</groupId>
  <artifactId>semantic-versions</artifactId>
  <version>1.0.0</version>
</dependency>
Conformance
476/476
vs semver4j
9.2–26×
.NETNuGet

C# for .NET 8+, no dependencies, AOT-compatible. Scans spans, so parsing allocates only the version itself.

install
dotnet add package SemanticVersions
Conformance
476/476
vs Semver
1.3–10×
PHPPackagist

PHP 8.1+, no dependencies. Immutable value objects with readonly properties.

install
composer require vltpkg/semantic-versions
Conformance
476/476
vs composer/semver
1.0–3.7×

JavaScript

2.4–11× faster than semver.

Timed against node-semver and @vltpkg/semver, the parser inside vlt, through each library's string API: the way satisfies, maxSatisfying and sort are called in practice. All three cache parsed ranges (this library and vlt's hold 4,096, node-semver an LRU of 1,000), so Parse a range is timed on the constructors, which bypass the caches, while satisfies and maxSatisfying run with them, as in practice.

Operationsemantic-versions1.0.1semver7.8.5@vltpkg/semver1.8.1vs semver
Parse a version5,398 published versions100 ns284 ns267 ns2.8× faster
Sort versions5,398 versions by precedence (per version)428 ns4.55 µs3.36 µs11× faster
Parse a range1,996 real dependency ranges (uncached)3.04 µs7.43 µs793 ns2.4× faster
satisfies(version, range)15,604 version × range checks184 ns1.06 µs313 ns5.8× faster
Resolve a range116 maxSatisfying lookups against a package's versions18.1 µs56.2 µs33.2 µs3.1× faster

Median time per operation, lower is better. 5,398 published versions and 1,996 dependency ranges from the npm registry. Node.js 22.23.5 · Intel(R) Xeon(R) Processor @ 2.10GHz · linux x64 · 2026-11-20.

Conformance

The other libraries implement Semantic Versioning 2.0.0 or their ecosystem's own rules, so they fail where this spec deliberately differs (build precedence, channels and contexts) and wherever they coerce input. That is the gap the spec closes, not a defect in them.

Featuresemantic-versionssemver@vltpkg/semver
Version grammarValid and invalid versions per the BNF 81/81 81/81 78/81
No coercionRejects v1.2.3, =1.2.3, 1.2.3pre, … 11/11 10/11 9/11
PrecedenceMajor, minor, patch and pre-release ordering 32/32 32/32 32/32
Build precedenceA build ranks above its release: 1.0.0 < 1.0.0+b 16/16 1/16 1/16
RangesComparators, ||, x-ranges, ~, ^, hyphen ranges 196/196 196/196 195/196
Approximate rangesThe pessimistic operator ~> 26/26 19/26 19/26
Pre-release channels^1.0.0-rc admits rc.*, never beta 44/44 33/44 33/44
Pre-release wildcardsX.Y.Z-* and *-* opt in explicitly 14/14 2/14 7/14
Build channels^1.0.0+win admits +win.* builds only 41/41 19/41 23/41
Contextsnpm:react@18.2.0, npm:react@^18 15/15 3/15 3/15
All cases476/476396/476400/476

Rust

Up to 1.3× faster than nodejs-semver, at most 1.12× slower.

Timed against Cargo's semver and npm-compatible nodejs-semver, parsing once and comparing parsed values.

Operationsemantic-versions1.0.0nodejs-semver7.0.0semver1.0.28vs nodejs-semver
Parse a version5398 published versions24.8 ns27.6 ns26.0 ns1.1× faster
Sort versions5398 parsed versions by precedence (per version)132 ns118 ns142 ns1.12× slower
Parse a range1996 real dependency ranges231 ns308 ns—1.3× faster
Range::test(version)15604 version × range checks7.4 ns9.4 ns—1.3× faster
Resolve a range116 max-satisfying lookups against a package's versions1.24 µs1.54 µs—1.2× faster

Median time per operation, lower is better. 5,398 published versions and 1,996 dependency ranges from the npm registry. rustc 1.97.0 · Intel(R) Xeon(R) Processor @ 2.10GHz · linux x86_64 · 2026-11-19. semver: Cargo's requirement syntax (bare versions mean ^, comparators are comma-separated, no || or hyphen ranges), so it is compared on versions only.

Conformance

The other libraries implement Semantic Versioning 2.0.0 or their ecosystem's own rules, so they fail where this spec deliberately differs (build precedence, channels and contexts) and wherever they coerce input. That is the gap the spec closes, not a defect in them.

Featuresemantic-versionsnodejs-semversemver
Version grammarValid and invalid versions per the BNF 81/81 59/81 81/81
No coercionRejects v1.2.3, =1.2.3, 1.2.3pre, … 11/11 3/11 11/11
PrecedenceMajor, minor, patch and pre-release ordering 32/32 32/32 32/32
Build precedenceA build ranks above its release: 1.0.0 < 1.0.0+b 16/16 1/16 15/16
RangesComparators, ||, x-ranges, ~, ^, hyphen ranges 196/196 192/196 134/169
Approximate rangesThe pessimistic operator ~> 26/26 19/26 9/19
Pre-release channels^1.0.0-rc admits rc.*, never beta 44/44 33/44 34/44
Pre-release wildcardsX.Y.Z-* and *-* opt in explicitly 14/14 2/14 2/13
Build channels^1.0.0+win admits +win.* builds only 41/41 22/41 19/36
Contextsnpm:react@18.2.0, npm:react@^18 15/15 3/15 3/15
All cases476/476366/476340/436

Python

1.5–17× faster than node-semver.

Timed against node-semver (npm's rules, ported to Python) and python-semver, parsing once and comparing parsed values.

Operationsemantic-versions1.0.0node-semver0.9.1semver3.1.2vs node-semver
Parse a version5398 published versions1.05 µs1.60 µs1.64 µs1.5× faster
Sort versions5398 parsed versions by precedence (per version)645 ns11.1 µs7.04 µs17× faster
Parse a range1996 real dependency ranges4.15 µs15.5 µs—3.7× faster
range.test(version)15604 version × range checks229 ns2.01 µs—8.8× faster
Resolve a range116 max-satisfying lookups against a package's versions47.5 µs319.8 µs—6.7× faster

Median time per operation, lower is better. 5,398 published versions and 1,996 dependency ranges from the npm registry. CPython 3.13.18 · Intel(R) Xeon(R) Processor @ 2.10GHz · linux x86_64 · 2026-11-19. semver: python-semver has no npm-style ranges (only single comparisons such as >=1.2.3), so it is compared on versions only.

Conformance

The other libraries implement Semantic Versioning 2.0.0 or their ecosystem's own rules, so they fail where this spec deliberately differs (build precedence, channels and contexts) and wherever they coerce input. That is the gap the spec closes, not a defect in them.

Featuresemantic-versionsnode-semversemver
Version grammarValid and invalid versions per the BNF 81/81 80/81 80/81
No coercionRejects v1.2.3, =1.2.3, 1.2.3pre, … 11/11 10/11 7/7
PrecedenceMajor, minor, patch and pre-release ordering 32/32 32/32 32/32
Build precedenceA build ranks above its release: 1.0.0 < 1.0.0+b 16/16 1/16 1/16
RangesComparators, ||, x-ranges, ~, ^, hyphen ranges 196/196 171/196 n/a
Approximate rangesThe pessimistic operator ~> 26/26 15/26 n/a
Pre-release channels^1.0.0-rc admits rc.*, never beta 44/44 33/44 n/a
Pre-release wildcardsX.Y.Z-* and *-* opt in explicitly 14/14 2/14 n/a
Build channels^1.0.0+win admits +win.* builds only 41/41 19/41 n/a
Contextsnpm:react@18.2.0, npm:react@^18 15/15 3/15 0/8
All cases476/476366/476120/144

Go

2.8–23× faster than Masterminds/semver.

Timed against Masterminds/semver, the most widely used Go library with npm-style constraints, and blang/semver, parsing once and comparing parsed values.

Operationsemantic-versions1.0.0Masterminds/semver3.5.0blang/semver4.0.0vs Masterminds/semver
Parse a version5398 published versions31.1 ns602 ns173 ns19× faster
Sort versions5398 parsed versions by precedence (per version)203 ns558 ns262 ns2.8× faster
Parse a range1996 real dependency ranges388 ns6.91 µs—18× faster
Range.Test(version)15604 version × range checks28.4 ns647 ns—23× faster
Resolve a range116 max-satisfying lookups against a package's versions4.26 µs95.5 µs—22× faster

Median time per operation, lower is better. 5,398 published versions and 1,996 dependency ranges from the npm registry. go1.24.7 · Intel(R) Xeon(R) Processor @ 2.10GHz · linux amd64 · 2026-11-19. Masterminds/semver: NewVersion is lenient by design (it accepts v1.2 and coerces it), which is why it fails the strict-parsing cases. blang/semver: Its range syntax has no ^, ~ or x-ranges, so it is compared on versions only.

Conformance

The other libraries implement Semantic Versioning 2.0.0 or their ecosystem's own rules, so they fail where this spec deliberately differs (build precedence, channels and contexts) and wherever they coerce input. That is the gap the spec closes, not a defect in them.

Featuresemantic-versionsMasterminds/semverblang/semver
Version grammarValid and invalid versions per the BNF 81/81 74/81 81/81
No coercionRejects v1.2.3, =1.2.3, 1.2.3pre, … 11/11 10/11 11/11
PrecedenceMajor, minor, patch and pre-release ordering 32/32 32/32 32/32
Build precedenceA build ranks above its release: 1.0.0 < 1.0.0+b 16/16 1/16 1/16
RangesComparators, ||, x-ranges, ~, ^, hyphen ranges 196/196 164/169 114/169
Approximate rangesThe pessimistic operator ~> 26/26 15/19 9/19
Pre-release channels^1.0.0-rc admits rc.*, never beta 44/44 28/44 29/44
Pre-release wildcardsX.Y.Z-* and *-* opt in explicitly 14/14 2/13 2/13
Build channels^1.0.0+win admits +win.* builds only 41/41 19/36 21/36
Contextsnpm:react@18.2.0, npm:react@^18 15/15 3/15 3/15
All cases476/476348/436303/436

Ruby

1.7–20× faster than semantic_range.

Timed against semantic_range (node-semver ported to Ruby, used by Libraries.io) and RubyGems' own Gem::Version, parsing once and comparing parsed values.

Operationsemantic-versions1.0.0semantic_range3.1.1Gem::Version3.5.22vs semantic_range
Parse a version5398 published versions1.36 µs2.25 µs1.23 µs1.7× faster
Sort versions5398 parsed versions by precedence (per version)2.56 µs23.6 µs4.40 µs9.2× faster
Parse a range1996 real dependency ranges8.48 µs31.2 µs—3.7× faster
range.test(version)15604 version × range checks376 ns7.38 µs—20× faster
Resolve a range116 max-satisfying lookups against a package's versions60.4 µs1.04 ms—17× faster

Median time per operation, lower is better. 5,398 published versions and 1,996 dependency ranges from the npm registry. ruby 3.3.6 · Intel(R) Xeon(R) Processor @ 2.10GHz · linux x86_64 · 2026-11-19. Gem::Version: Parsing is timed without Gem::Version.new's per-string cache, and Gem::Version defers splitting into segments until the first comparison (part of its sort time). RubyGems' own requirement syntax (~> 1.2, comma-separated comparators, no ^, || or x-ranges) and lenient versions (1.2 is accepted), so it is compared on versions only.

Conformance

The other libraries implement Semantic Versioning 2.0.0 or their ecosystem's own rules, so they fail where this spec deliberately differs (build precedence, channels and contexts) and wherever they coerce input. That is the gap the spec closes, not a defect in them.

Featuresemantic-versionssemantic_rangeGem::Version
Version grammarValid and invalid versions per the BNF 81/81 80/81 37/81
No coercionRejects v1.2.3, =1.2.3, 1.2.3pre, … 11/11 10/11 9/11
PrecedenceMajor, minor, patch and pre-release ordering 32/32 32/32 24/32
Build precedenceA build ranks above its release: 1.0.0 < 1.0.0+b 16/16 1/16 1/16
RangesComparators, ||, x-ranges, ~, ^, hyphen ranges 196/196 171/196 104/169
Approximate rangesThe pessimistic operator ~> 26/26 15/26 19/19
Pre-release channels^1.0.0-rc admits rc.*, never beta 44/44 33/44 32/44
Pre-release wildcardsX.Y.Z-* and *-* opt in explicitly 14/14 2/14 2/13
Build channels^1.0.0+win admits +win.* builds only 41/41 19/41 19/36
Contextsnpm:react@18.2.0, npm:react@^18 15/15 3/15 3/15
All cases476/476366/476250/436

Java

9.2–26× faster than semver4j.

Timed against semver4j (npm-compatible ranges) and java-semver, parsing once and comparing parsed values, after a one-second JIT warm-up.

Operationsemantic-versions1.0.0semver4j6.0.0java-semver0.10.2vs semver4j
Parse a version5398 published versions42.5 ns611 ns319 ns14× faster
Sort versions5398 parsed versions by precedence (per version)134 ns1.24 µs157 ns9.3× faster
Parse a range1996 real dependency ranges248 ns6.47 µs—26× faster
range.test(version)15604 version × range checks7.7 ns70.7 ns—9.2× faster
Resolve a range116 max-satisfying lookups against a package's versions1.18 µs15.5 µs—13× faster

Median time per operation, lower is better. 5,398 published versions and 1,996 dependency ranges from the npm registry. OpenJDK 21 · Intel(R) Xeon(R) Processor @ 2.10GHz · linux amd64 · 2026-11-19. java-semver: Its range expressions use their own syntax (& and | operators), so it is compared on versions only.

Conformance

The other libraries implement Semantic Versioning 2.0.0 or their ecosystem's own rules, so they fail where this spec deliberately differs (build precedence, channels and contexts) and wherever they coerce input. That is the gap the spec closes, not a defect in them.

Featuresemantic-versionssemver4jjava-semver
Version grammarValid and invalid versions per the BNF 81/81 81/81 81/81
No coercionRejects v1.2.3, =1.2.3, 1.2.3pre, … 11/11 10/11 11/11
PrecedenceMajor, minor, patch and pre-release ordering 32/32 31/32 32/32
Build precedenceA build ranks above its release: 1.0.0 < 1.0.0+b 16/16 1/16 13/16
RangesComparators, ||, x-ranges, ~, ^, hyphen ranges 196/196 161/169 124/169
Approximate rangesThe pessimistic operator ~> 26/26 15/19 9/19
Pre-release channels^1.0.0-rc admits rc.*, never beta 44/44 33/44 26/44
Pre-release wildcardsX.Y.Z-* and *-* opt in explicitly 14/14 2/13 2/13
Build channels^1.0.0+win admits +win.* builds only 41/41 19/36 21/36
Contextsnpm:react@18.2.0, npm:react@^18 15/15 3/15 3/15
All cases476/476356/436322/436

.NET

1.3–10× faster than Semver.

Timed against Semver, the most downloaded .NET version library (npm ranges via SemVersionRange.ParseNpm), and SemanticVersioning, a port of node-semver, after a one-second JIT warm-up.

Operationsemantic-versions1.0.0Semver3.0.0SemanticVersioning3.0.0vs Semver
Parse a version5398 published versions36.6 ns373 ns594 ns10× faster
Sort versions5398 parsed versions by precedence (per version)101 ns162 ns778 ns1.6× faster
Parse a range1996 real dependency ranges330 ns712 ns18.2 µs2.2× faster
range.Test(version)15604 version × range checks7.5 ns9.6 ns74.9 ns1.3× faster
Resolve a range116 max-satisfying lookups against a package's versions1.44 µs2.02 µs32.3 µs1.4× faster

Median time per operation, lower is better. 5,398 published versions and 1,996 dependency ranges from the npm registry. .NET 10.0.15 · Intel(R) Xeon(R) Processor @ 2.10GHz · linux x64 · 2026-11-19. Semver: Compared by precedence (ComparePrecedence), which ignores builds as SemVer 2.0.0 specifies.

Conformance

The other libraries implement Semantic Versioning 2.0.0 or their ecosystem's own rules, so they fail where this spec deliberately differs (build precedence, channels and contexts) and wherever they coerce input. That is the gap the spec closes, not a defect in them.

Featuresemantic-versionsSemverSemanticVersioning
Version grammarValid and invalid versions per the BNF 81/81 80/81 57/81
No coercionRejects v1.2.3, =1.2.3, 1.2.3pre, … 11/11 11/11 7/11
PrecedenceMajor, minor, patch and pre-release ordering 32/32 32/32 32/32
Build precedenceA build ranks above its release: 1.0.0 < 1.0.0+b 16/16 1/16 1/16
RangesComparators, ||, x-ranges, ~, ^, hyphen ranges 196/196 169/169 169/169
Approximate rangesThe pessimistic operator ~> 26/26 15/19 9/19
Pre-release channels^1.0.0-rc admits rc.*, never beta 44/44 33/44 33/44
Pre-release wildcardsX.Y.Z-* and *-* opt in explicitly 14/14 2/13 2/13
Build channels^1.0.0+win admits +win.* builds only 41/41 19/36 19/36
Contextsnpm:react@18.2.0, npm:react@^18 15/15 3/15 3/15
All cases476/476365/436332/436

PHP

Up to 3.7× faster than composer/semver.

Timed against composer/semver, the constraint engine inside Composer, and z4kn4fein/php-semver, parsing once and comparing parsed values.

Operationsemantic-versions1.0.0composer/semver3.6.0z4kn4fein/php-semver3.0.0vs composer/semver
Parse a version5398 published versions440 ns1.00 µs755 ns2.3× faster
Sort versions5398 parsed versions by precedence (per version)1.99 µs1.94 µs2.61 µsabout the same
Parse a range797 real dependency ranges2.77 µs2.85 µs3.26 µsabout the same
range->test(version)13654 version × range checks205 ns741 ns601 ns3.6× faster
Resolve a range103 max-satisfying lookups against a package's versions33.4 µs124.1 µs86.7 µs3.7× faster

Median time per operation, lower is better. 5,398 published versions and 797 dependency ranges from the npm registry. PHP 8.3.6 · Intel(R) Xeon(R) Processor @ 2.10GHz · linux x86_64 · 2026-11-20. composer/semver: Composer's model differs by design: versions normalize to four parts with stability flags (1.0.0-rc.1 becomes 1.0.0.0-RC1), builds are dropped, and pre-release names outside alpha, beta, RC and patch are rejected. Versions are scored on parsing to the same value.

Conformance

The other libraries implement Semantic Versioning 2.0.0 or their ecosystem's own rules, so they fail where this spec deliberately differs (build precedence, channels and contexts) and wherever they coerce input. That is the gap the spec closes, not a defect in them.

Featuresemantic-versionscomposer/semverz4kn4fein/php-semver
Version grammarValid and invalid versions per the BNF 81/81 57/81 80/81
No coercionRejects v1.2.3, =1.2.3, 1.2.3pre, … 11/11 8/11 11/11
PrecedenceMajor, minor, patch and pre-release ordering 32/32 18/32 32/32
Build precedenceA build ranks above its release: 1.0.0 < 1.0.0+b 16/16 1/16 1/16
RangesComparators, ||, x-ranges, ~, ^, hyphen ranges 196/196 138/169 161/169
Approximate rangesThe pessimistic operator ~> 26/26 9/19 15/19
Pre-release channels^1.0.0-rc admits rc.*, never beta 44/44 26/44 19/44
Pre-release wildcardsX.Y.Z-* and *-* opt in explicitly 14/14 2/13 2/13
Build channels^1.0.0+win admits +win.* builds only 41/41 20/36 19/36
Contextsnpm:react@18.2.0, npm:react@^18 15/15 3/15 3/15
All cases476/476282/436343/436

Other languages

Missing yours? Everything needed to build one is published: the specification, the BNF grammars, and the conformance suite as plain JSON. An implementation that passes every case behaves like the ones above. Open an issue and it can be listed here.