Skip to main content

performance benchmarks Zygos Performance Benchmarks

Performance comparison between Zygos, Neverthrow (Result) and fp-ts (Option).

Data auto-generated on Jan 29, 2026.

TL;DR

Zygos wins 80% of Result benchmarks vs Neverthrow. Up to 3x faster on object creation, 2-3x faster on chained operations. Similar performance on simple operations like isOk() and unwrapOr().

Operations per second. Higher is better.


Methodology

Each benchmark:

  1. Creates test data matching real-world patterns (Result chains, Option transformations)
  2. Runs operations in a tight loop
  3. Measures operations per second with statistical analysis
  4. Reports min, max, mean, percentiles (p75, p99, p995, p999)
  5. Includes relative margin of error (rme) for confidence

The "fastest" label is only awarded when the winner is ≥10% faster than the runner-up. Otherwise, it's considered a statistical tie.


Libraries Tested

LibraryVersionDescription
zygos1.1.0Pithos Result/Option module (lightweight, tree-shakable)
neverthrow8.2.0Popular Result library for TypeScript
Benchmarks run on Jan 29, 2026

Result Pattern (Zygos vs Neverthrow)

The Result pattern is the core of error handling in both libraries. Here's how they compare:

Testzygosneverthrow
andThen-chain
15.63M ops/s
fastest
4.37M ops/s
(3.57x)
andThen-err
25.10M ops/s
(1x)
25.13M ops/s
fastest
andThen-ok
22.39M ops/s
fastest
9.93M ops/s
(2.26x)
combine-all-ok
17.09M ops/s
fastest
6.61M ops/s
(2.59x)
combine-large
3.58M ops/s
fastest
2.49M ops/s
(1.44x)
combine-with-err
17.58M ops/s
fastest
6.69M ops/s
(2.63x)
err-creation
21.04M ops/s
fastest
7.17M ops/s
(2.93x)
fromThrowable-error
233.68K ops/s
(1.01x)
235.96K ops/s
fastest
fromThrowable-success
4.90M ops/s
fastest
4.89M ops/s
(1x)
isErr
25.30M ops/s
fastest
25.27M ops/s
(1x)
isOk
25.36M ops/s
fastest
25.20M ops/s
(1.01x)
map-err
28.47M ops/s
fastest
28.44M ops/s
(1x)
map-ok
28.38M ops/s
fastest
28.32M ops/s
(1x)
mapErr
28.44M ops/s
fastest
28.41M ops/s
(1x)
match-err
28.31M ops/s
(1x)
28.32M ops/s
fastest
match-ok
28.23M ops/s
fastest
27.99M ops/s
(1.01x)
ok-complex
21.37M ops/s
fastest
7.13M ops/s
(3x)
ok-creation
21.00M ops/s
fastest
9.98M ops/s
(2.1x)
unwrapOr-err
25.17M ops/s
(1x)
25.29M ops/s
fastest
unwrapOr-ok
25.33M ops/s
fastest
25.32M ops/s
(1x)
Data generated on Jan 29, 2026 • Vitest bench

Key Findings

Object creation is 2-3x faster. Zygos uses simple object literals while Neverthrow uses class instantiation with more overhead.

Chained operations (andThen) are 2-4x faster. Zygos's simpler implementation pays off when chaining multiple operations.

Simple operations are equivalent. isOk(), isErr(), unwrapOr() perform identically: both are just property checks.

Option Pattern (Zygos vs fp-ts)

Zygos provides a lightweight Option implementation compared to fp-ts's more comprehensive (but heavier) approach:

TestZygosfp-ts
flatMap
17.07M ops/s
fastest
2.16M ops/s
(7.9x)
fromNullable
21.18M ops/s
fastest
12.53M ops/s
(1.69x)
fromNullable-null
21.42M ops/s
fastest
12.74M ops/s
(1.68x)
getOrElse
20.48M ops/s
fastest
10.37M ops/s
(1.98x)
isSome
20.54M ops/s
fastest
12.33M ops/s
(1.67x)
map
20.27M ops/s
fastest
10.06M ops/s
(2.01x)
match
20.35M ops/s
fastest
10.00M ops/s
(2.04x)
some-creation
21.11M ops/s
fastest
13.70M ops/s
(1.54x)
Data generated on Jan 29, 2026 • Vitest bench

Key Findings

Zygos is 1.5-8x faster across all Option operations. The biggest wins are on flatMap (8x) and getOrElse (2x).

fp-ts's pipe adds overhead. While elegant, the functional composition style has a runtime cost.

Zygos uses direct function calls. No intermediate abstractions, just simple conditionals.

📊 Performance Summary

Result (vs Neverthrow)
🏆 Zygos: 16/20
Option (vs fp-ts)
🏆 Zygos: 8/8

Why Zygos is Fast

  1. Simple object literals: { _tag: "Ok", value } instead of class instances
  2. No intermediate abstractions: Direct property access, no method chains
  3. Modern JavaScript: ES2020+ target, no transpilation overhead
  4. Minimal code: Less code = less to execute

When Performance Doesn't Matter

For most applications, both Zygos and Neverthrow are "fast enough". The real differentiator is:

  • Bundle size: Zygos is 2.6x smaller than Neverthrow
  • API ergonomics: Choose what feels right for your team
  • Ecosystem: Zygos integrates with other Pithos modules

Detailed Statistics

For the skeptics who want to see the raw numbers:

Result20
andThen-chain
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆15.63M0.00000.03940.00010.00010.0001±0.12%7,812,553
neverthrow4.37M0.00010.06680.00020.00020.0003±0.13%2,186,487
andThen-err
Libraryops/sminmaxmeanp75p99rmesamples
neverthrow 🏆25.13M0.00000.03780.00000.00000.0001±0.13%12,564,743
zygos25.10M0.00000.10500.00000.00000.0001±0.13%12,548,149
andThen-ok
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆22.39M0.00000.28580.00000.00000.0001±0.20%11,196,072
neverthrow9.93M0.00000.15480.00010.00010.0001±0.17%4,962,641
combine-all-ok
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆17.09M0.00002.69030.00010.00010.0001±1.09%8,546,422
neverthrow6.61M0.00000.28380.00020.00020.0002±0.27%3,303,774
combine-large
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆3.58M0.00020.20670.00030.00030.0006±0.42%1,789,730
neverthrow2.49M0.00020.26850.00040.00040.0007±0.39%1,245,772
combine-with-err
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆17.58M0.00000.26360.00010.00010.0001±0.44%8,789,518
neverthrow6.69M0.00000.44470.00010.00020.0002±0.37%3,346,903
err-creation
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆21.04M0.00000.13670.00000.00000.0001±0.20%10,518,494
neverthrow7.17M0.00000.14300.00010.00010.0002±0.23%3,586,381
fromThrowable-error
Libraryops/sminmaxmeanp75p99rmesamples
neverthrow 🏆235.96K0.00381.62690.00420.00400.0086±0.79%117,980
zygos233.68K0.00380.56210.00430.00410.0097±0.50%116,839
fromThrowable-success
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆4.90M0.00010.04300.00020.00020.0003±0.12%2,447,979
neverthrow4.89M0.00010.13410.00020.00020.0003±0.16%2,446,526
isErr
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆25.30M0.00000.05260.00000.00000.0001±0.12%12,652,338
neverthrow25.27M0.00000.06330.00000.00000.0001±0.15%12,636,894
isOk
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆25.36M0.00000.07540.00000.00000.0001±0.13%12,682,172
neverthrow25.20M0.00000.09030.00000.00000.0001±0.13%12,600,520
map-err
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆28.47M0.00000.26280.00000.00000.0000±0.16%14,236,276
neverthrow28.44M0.00000.05710.00000.00000.0000±0.12%14,219,506
map-ok
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆28.38M0.00000.07070.00000.00000.0000±0.13%14,187,567
neverthrow28.32M0.00000.15970.00000.00000.0000±0.15%14,159,415
mapErr
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆28.44M0.00000.03900.00000.00000.0000±0.13%14,218,338
neverthrow28.41M0.00000.06730.00000.00000.0000±0.13%14,203,990
match-err
Libraryops/sminmaxmeanp75p99rmesamples
neverthrow 🏆28.32M0.00000.09560.00000.00000.0000±0.19%14,160,960
zygos28.31M0.00000.10780.00000.00000.0000±0.21%14,152,591
match-ok
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆28.23M0.00000.06850.00000.00000.0000±0.13%14,115,862
neverthrow27.99M0.00000.19380.00000.00000.0000±0.23%13,995,988
ok-complex
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆21.37M0.00000.24070.00000.00000.0001±0.23%10,682,566
neverthrow7.13M0.00000.11020.00010.00010.0002±0.24%3,564,423
ok-creation
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆21.00M0.00000.07810.00000.00000.0001±0.21%10,501,012
neverthrow9.98M0.00000.18120.00010.00010.0001±0.24%4,990,318
unwrapOr-err
Libraryops/sminmaxmeanp75p99rmesamples
neverthrow 🏆25.29M0.00000.06620.00000.00000.0001±0.13%12,647,338
zygos25.17M0.00000.11130.00000.00000.0001±0.14%12,586,019
unwrapOr-ok
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆25.33M0.00000.10780.00000.00000.0001±0.12%12,663,841
neverthrow25.32M0.00000.36400.00000.00000.0001±0.19%12,659,480
Option8
flatMap
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆17.07M0.00000.23980.00010.00010.0001±0.27%8,533,278
fp-ts/flatMap2.16M0.00030.31110.00050.00050.0006±0.34%1,079,701
fromNullable
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆21.18M0.00000.42900.00000.00000.0001±0.30%10,587,618
fp-ts/fromNullable12.53M0.00000.04310.00010.00010.0001±0.12%6,265,561
fromNullable-null
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆21.42M0.00000.07940.00000.00000.0001±0.12%10,709,367
fp-ts/fromNullable12.74M0.00000.06650.00010.00010.0001±0.13%6,369,362
getOrElse
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆20.48M0.00000.12040.00000.00000.0001±0.13%10,241,621
fp-ts/getOrElse10.37M0.00000.06990.00010.00010.0001±0.13%5,183,817
isSome
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆20.54M0.00000.81300.00000.00000.0001±0.34%10,269,219
fp-ts/isSome12.33M0.00000.08420.00010.00010.0001±0.13%6,163,962
map
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆20.27M0.00000.13480.00000.00000.0001±0.14%10,132,860
fp-ts/map10.06M0.00000.32810.00010.00010.0001±0.18%5,030,723
match
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆20.35M0.00000.31620.00000.00000.0001±0.19%10,175,539
fp-ts/match10.00M0.00000.28160.00010.00010.0001±0.17%5,000,125
some-creation
Libraryops/sminmaxmeanp75p99rmesamples
zygos 🏆21.11M0.00000.06430.00000.00000.0001±0.11%10,553,702
fp-ts/some13.70M0.00000.05860.00010.00010.0001±0.13%6,851,485

Reproduce These Results

Want to verify these results? See how to reproduce our data.


Related