---
title: "Libraries — implementations and benchmarks · semver.xyz"
description: "Semantic Versions for JavaScript, Rust, Python, Go, Ruby, Java, .NET and PHP: every implementation passes the shared conformance suite and is benchmarked against the libraries it replaces."
url: "https://semver.xyz/libraries/"
lang: "en"
---

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](https://github.com/vltpkg/semantic-versions/tree/main/conformance), 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

| Language                                                  | Package                        | Conformance | Compared with                | Speed vs. it |
| --------------------------------------------------------- | ------------------------------ | ----------- | ---------------------------- | ------------ |
| [JavaScript](https://www.semver.xyz/libraries#javascript) | `semantic-versions`            | 476/476     | `semver` 396/476             | 2.4–11×      |
| [Rust](https://www.semver.xyz/libraries#rust)             | `semantic-versions`            | 476/476     | `nodejs-semver` 366/476      | 0.9–1.3×     |
| [Python](https://www.semver.xyz/libraries#python)         | `semantic-versions`            | 476/476     | `node-semver` 366/476        | 1.5–17×      |
| [Go](https://www.semver.xyz/libraries#go)                 | `semver.xyz/go`                | 476/476     | `Masterminds/semver` 348/436 | 2.8–23×      |
| [Ruby](https://www.semver.xyz/libraries#ruby)             | `semantic-versions`            | 476/476     | `semantic_range` 366/476     | 1.7–20×      |
| [Java](https://www.semver.xyz/libraries#java)             | `xyz.semver:semantic-versions` | 476/476     | `semver4j` 356/436           | 9.2–26×      |
| [.NET](https://www.semver.xyz/libraries#dotnet)           | `SemanticVersions`             | 476/476     | `Semver` 365/436             | 1.3–10×      |
| [PHP](https://www.semver.xyz/libraries#php)               | `vltpkg/semantic-versions`     | 476/476     | `composer/semver` 282/436    | 1.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/`](https://github.com/vltpkg/semantic-versions/tree/main/benchmarks).

Install

JavaScript npm

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](https://www.semver.xyz/selector.md).

install

```
vlt install semantic-versions
```

**Conformance**: 476/476

**vs `semver`**: 2.4–11×

[npm](https://www.npmjs.com/package/semantic-versions) [Source](https://github.com/vltpkg/semantic-versions/tree/main/libraries/javascript) [Benchmarks](https://www.semver.xyz/libraries#javascript)

Rust crates.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×

[crates.io](https://crates.io/crates/semantic-versions) [docs.rs](https://docs.rs/semantic-versions) [Source](https://github.com/vltpkg/semantic-versions/tree/main/libraries/rust) [Benchmarks](https://www.semver.xyz/libraries#rust)

Python PyPI

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×

[PyPI](https://pypi.org/project/semantic-versions/) [Source](https://github.com/vltpkg/semantic-versions/tree/main/libraries/python) [Benchmarks](https://www.semver.xyz/libraries#python)

Go pkg.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×

[pkg.go.dev](https://pkg.go.dev/semver.xyz/go) [Source](https://github.com/vltpkg/semantic-versions/tree/main/libraries/go) [Benchmarks](https://www.semver.xyz/libraries#go)

Ruby RubyGems

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×

[RubyGems](https://rubygems.org/gems/semantic-versions) [Source](https://github.com/vltpkg/semantic-versions/tree/main/libraries/ruby) [Benchmarks](https://www.semver.xyz/libraries#ruby)

Java Maven 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×

[Maven Central](https://central.sonatype.com/artifact/xyz.semver/semantic-versions) [Source](https://github.com/vltpkg/semantic-versions/tree/main/libraries/java) [Benchmarks](https://www.semver.xyz/libraries#java)

.NET NuGet

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×

[NuGet](https://www.nuget.org/packages/SemanticVersions) [Source](https://github.com/vltpkg/semantic-versions/tree/main/libraries/dotnet) [Benchmarks](https://www.semver.xyz/libraries#dotnet)

PHP Packagist

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×

[Packagist](https://packagist.org/packages/vltpkg/semantic-versions) [Source](https://github.com/vltpkg/semantic-versions/tree/main/libraries/php) [Benchmarks](https://www.semver.xyz/libraries#php)

JavaScript

## 2.4–11× faster than `semver`.

Timed against [node-semver](https://www.npmjs.com/package/semver) and [@vltpkg/semver](https://www.npmjs.com/package/@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.

| Operation                                                             | `semantic-versions` 1.0.1 | `semver` 7.8.5 | `@vltpkg/semver` 1.8.1 | vs `semver` |
| --------------------------------------------------------------------- | ------------------------- | -------------- | ---------------------- | ----------- |
| Parse a version5,398 published versions                               | 100 ns                    | 284 ns         | 267 ns                 | 2.8× faster |
| Sort versions5,398 versions by precedence (per version)               | 428 ns                    | 4.55 µs        | 3.36 µs                | 11× faster  |
| Parse a range1,996 real dependency ranges (uncached)                  | 3.04 µs                   | 7.43 µs        | 793 ns                 | 2.4× faster |
| satisfies(version, range)15,604 version × range checks                | 184 ns                    | 1.06 µs        | 313 ns                 | 5.8× faster |
| Resolve a range116 maxSatisfying lookups against a package's versions | 18.1 µs                   | 56.2 µs        | 33.2 µs                | 3.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.

| Feature                                                            | `semantic-versions` | `semver`    | `@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 wildcards`X.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            |
| Contexts`npm:react@18.2.0`, `npm:react@^18`                        | 15/15               | 3/15        | 3/15             |
| All cases                                                          | **476/476**         | **396/476** | **400/476**      |

Rust

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

Timed against Cargo's [`semver`](https://crates.io/crates/semver) and npm-compatible [`nodejs-semver`](https://crates.io/crates/nodejs-semver), parsing once and comparing parsed values.

| Operation                                                              | `semantic-versions` 1.0.0 | `nodejs-semver` 7.0.0 | `semver` 1.0.28 | vs `nodejs-semver` |
| ---------------------------------------------------------------------- | ------------------------- | --------------------- | --------------- | ------------------ |
| Parse a version5398 published versions                                 | 24.8 ns                   | 27.6 ns               | 26.0 ns         | 1.1× faster        |
| Sort versions5398 parsed versions by precedence (per version)          | 132 ns                    | 118 ns                | 142 ns          | 1.12× slower       |
| Parse a range1996 real dependency ranges                               | 231 ns                    | 308 ns                | —               | 1.3× faster        |
| Range::test(version)15604 version × range checks                       | 7.4 ns                    | 9.4 ns                | —               | 1.3× faster        |
| Resolve a range116 max-satisfying lookups against a package's versions | 1.24 µs                   | 1.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.

| Feature                                                            | `semantic-versions` | `nodejs-semver` | `semver`    |
| ------------------------------------------------------------------ | ------------------- | --------------- | ----------- |
| 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 wildcards`X.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       |
| Contexts`npm:react@18.2.0`, `npm:react@^18`                        | 15/15               | 3/15            | 3/15        |
| All cases                                                          | **476/476**         | **366/476**     | **340/436** |

Python

## 1.5–17× faster than `node-semver`.

Timed against [node-semver](https://pypi.org/project/node-semver/) (npm's rules, ported to Python) and [python-semver](https://pypi.org/project/semver/), parsing once and comparing parsed values.

| Operation                                                              | `semantic-versions` 1.0.0 | `node-semver` 0.9.1 | `semver` 3.1.2 | vs `node-semver` |
| ---------------------------------------------------------------------- | ------------------------- | ------------------- | -------------- | ---------------- |
| Parse a version5398 published versions                                 | 1.05 µs                   | 1.60 µs             | 1.64 µs        | 1.5× faster      |
| Sort versions5398 parsed versions by precedence (per version)          | 645 ns                    | 11.1 µs             | 7.04 µs        | 17× faster       |
| Parse a range1996 real dependency ranges                               | 4.15 µs                   | 15.5 µs             | —              | 3.7× faster      |
| range.test(version)15604 version × range checks                        | 229 ns                    | 2.01 µs             | —              | 8.8× faster      |
| Resolve a range116 max-satisfying lookups against a package's versions | 47.5 µs                   | 319.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.

| Feature                                                            | `semantic-versions` | `node-semver` | `semver`    |
| ------------------------------------------------------------------ | ------------------- | ------------- | ----------- |
| 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 wildcards`X.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         |
| Contexts`npm:react@18.2.0`, `npm:react@^18`                        | 15/15               | 3/15          | 0/8         |
| All cases                                                          | **476/476**         | **366/476**   | **120/144** |

Go

## 2.8–23× faster than `Masterminds/semver`.

Timed against [Masterminds/semver](https://github.com/Masterminds/semver), the most widely used Go library with npm-style constraints, and [blang/semver](https://github.com/blang/semver), parsing once and comparing parsed values.

| Operation                                                              | `semantic-versions` 1.0.0 | `Masterminds/semver` 3.5.0 | `blang/semver` 4.0.0 | vs `Masterminds/semver` |
| ---------------------------------------------------------------------- | ------------------------- | -------------------------- | -------------------- | ----------------------- |
| Parse a version5398 published versions                                 | 31.1 ns                   | 602 ns                     | 173 ns               | 19× faster              |
| Sort versions5398 parsed versions by precedence (per version)          | 203 ns                    | 558 ns                     | 262 ns               | 2.8× faster             |
| Parse a range1996 real dependency ranges                               | 388 ns                    | 6.91 µs                    | —                    | 18× faster              |
| Range.Test(version)15604 version × range checks                        | 28.4 ns                   | 647 ns                     | —                    | 23× faster              |
| Resolve a range116 max-satisfying lookups against a package's versions | 4.26 µs                   | 95.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.

| Feature                                                            | `semantic-versions` | `Masterminds/semver` | `blang/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 wildcards`X.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          |
| Contexts`npm:react@18.2.0`, `npm:react@^18`                        | 15/15               | 3/15                 | 3/15           |
| All cases                                                          | **476/476**         | **348/436**          | **303/436**    |

Ruby

## 1.7–20× faster than `semantic_range`.

Timed against [semantic_range](https://github.com/librariesio/semantic_range) (node-semver ported to Ruby, used by Libraries.io) and RubyGems' own `Gem::Version`, parsing once and comparing parsed values.

| Operation                                                              | `semantic-versions` 1.0.0 | `semantic_range` 3.1.1 | `Gem::Version` 3.5.22 | vs `semantic_range` |
| ---------------------------------------------------------------------- | ------------------------- | ---------------------- | --------------------- | ------------------- |
| Parse a version5398 published versions                                 | 1.36 µs                   | 2.25 µs                | 1.23 µs               | 1.7× faster         |
| Sort versions5398 parsed versions by precedence (per version)          | 2.56 µs                   | 23.6 µs                | 4.40 µs               | 9.2× faster         |
| Parse a range1996 real dependency ranges                               | 8.48 µs                   | 31.2 µs                | —                     | 3.7× faster         |
| range.test(version)15604 version × range checks                        | 376 ns                    | 7.38 µs                | —                     | 20× faster          |
| Resolve a range116 max-satisfying lookups against a package's versions | 60.4 µs                   | 1.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.

| Feature                                                            | `semantic-versions` | `semantic_range` | `Gem::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 wildcards`X.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          |
| Contexts`npm:react@18.2.0`, `npm:react@^18`                        | 15/15               | 3/15             | 3/15           |
| All cases                                                          | **476/476**         | **366/476**      | **250/436**    |

Java

## 9.2–26× faster than `semver4j`.

Timed against [semver4j](https://github.com/semver4j/semver4j) (npm-compatible ranges) and [java-semver](https://github.com/zafarkhaja/jsemver), parsing once and comparing parsed values, after a one-second JIT warm-up.

| Operation                                                              | `semantic-versions` 1.0.0 | `semver4j` 6.0.0 | `java-semver` 0.10.2 | vs `semver4j` |
| ---------------------------------------------------------------------- | ------------------------- | ---------------- | -------------------- | ------------- |
| Parse a version5398 published versions                                 | 42.5 ns                   | 611 ns           | 319 ns               | 14× faster    |
| Sort versions5398 parsed versions by precedence (per version)          | 134 ns                    | 1.24 µs          | 157 ns               | 9.3× faster   |
| Parse a range1996 real dependency ranges                               | 248 ns                    | 6.47 µs          | —                    | 26× faster    |
| range.test(version)15604 version × range checks                        | 7.7 ns                    | 70.7 ns          | —                    | 9.2× faster   |
| Resolve a range116 max-satisfying lookups against a package's versions | 1.18 µs                   | 15.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.

| Feature                                                            | `semantic-versions` | `semver4j`  | `java-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 wildcards`X.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         |
| Contexts`npm:react@18.2.0`, `npm:react@^18`                        | 15/15               | 3/15        | 3/15          |
| All cases                                                          | **476/476**         | **356/436** | **322/436**   |

.NET

## 1.3–10× faster than `Semver`.

Timed against [Semver](https://www.nuget.org/packages/Semver), the most downloaded .NET version library (npm ranges via `SemVersionRange.ParseNpm`), and [SemanticVersioning](https://www.nuget.org/packages/SemanticVersioning), a port of node-semver, after a one-second JIT warm-up.

| Operation                                                              | `semantic-versions` 1.0.0 | `Semver` 3.0.0 | `SemanticVersioning` 3.0.0 | vs `Semver` |
| ---------------------------------------------------------------------- | ------------------------- | -------------- | -------------------------- | ----------- |
| Parse a version5398 published versions                                 | 36.6 ns                   | 373 ns         | 594 ns                     | 10× faster  |
| Sort versions5398 parsed versions by precedence (per version)          | 101 ns                    | 162 ns         | 778 ns                     | 1.6× faster |
| Parse a range1996 real dependency ranges                               | 330 ns                    | 712 ns         | 18.2 µs                    | 2.2× faster |
| range.Test(version)15604 version × range checks                        | 7.5 ns                    | 9.6 ns         | 74.9 ns                    | 1.3× faster |
| Resolve a range116 max-satisfying lookups against a package's versions | 1.44 µs                   | 2.02 µs        | 32.3 µs                    | 1.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.

| Feature                                                            | `semantic-versions` | `Semver`    | `SemanticVersioning` |
| ------------------------------------------------------------------ | ------------------- | ----------- | -------------------- |
| 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 wildcards`X.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                |
| Contexts`npm:react@18.2.0`, `npm:react@^18`                        | 15/15               | 3/15        | 3/15                 |
| All cases                                                          | **476/476**         | **365/436** | **332/436**          |

PHP

## Up to 3.7× faster than `composer/semver`.

Timed against [composer/semver](https://github.com/composer/semver), the constraint engine inside Composer, and [z4kn4fein/php-semver](https://github.com/z4kn4fein/php-semver), parsing once and comparing parsed values.

| Operation                                                              | `semantic-versions` 1.0.0 | `composer/semver` 3.6.0 | `z4kn4fein/php-semver` 3.0.0 | vs `composer/semver` |
| ---------------------------------------------------------------------- | ------------------------- | ----------------------- | ---------------------------- | -------------------- |
| Parse a version5398 published versions                                 | 440 ns                    | 1.00 µs                 | 755 ns                       | 2.3× faster          |
| Sort versions5398 parsed versions by precedence (per version)          | 1.99 µs                   | 1.94 µs                 | 2.61 µs                      | about the same       |
| Parse a range797 real dependency ranges                                | 2.77 µs                   | 2.85 µs                 | 3.26 µs                      | about the same       |
| range->test(version)13654 version × range checks                       | 205 ns                    | 741 ns                  | 601 ns                       | 3.6× faster          |
| Resolve a range103 max-satisfying lookups against a package's versions | 33.4 µs                   | 124.1 µs                | 86.7 µs                      | 3.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.

| Feature                                                            | `semantic-versions` | `composer/semver` | `z4kn4fein/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 wildcards`X.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                  |
| Contexts`npm:react@18.2.0`, `npm:react@^18`                        | 15/15               | 3/15              | 3/15                   |
| All cases                                                          | **476/476**         | **282/436**       | **343/436**            |

Other languages

Missing yours? Everything needed to build one is published: the [specification](https://www.semver.xyz/spec.md), the [BNF grammars](https://www.semver.xyz/grammar.md), and the [conformance suite](https://github.com/vltpkg/semantic-versions/tree/main/conformance) as plain JSON. An implementation that passes every case behaves like the ones above. [Open an issue](https://github.com/vltpkg/semantic-versions/issues) and it can be listed here.
