DEV Community

ANKUSH CHOUDHARY JOHAL
ANKUSH CHOUDHARY JOHAL

Posted on • Originally published at johal.in

Benchmark: asdf 0.10 vs. nvm 0.40 vs. fnm 1.35 for Node.js Version Switching Speed

Benchmark: asdf 0.10 vs nvm 0.40 vs fnm 1.35 for Node.js Version Switching Speed

Node.js developers rely on version managers to switch between runtime versions for different projects. Three popular tools dominate the ecosystem: asdf (general-purpose version manager), nvm (Node Version Manager), and fnm (Fast Node Manager). This benchmark compares the 0.10, 0.40, and 1.35 releases of these tools respectively, focusing on version switching speed and related operations.

Test Setup

All tests were run on a 2023 MacBook Pro with Apple M2 Pro, 16GB RAM, and 512GB SSD running macOS Ventura 13.5. We used the following tool versions:

  • asdf 0.10.2 (latest 0.10.x release)
  • nvm 0.40.1 (latest 0.40.x release)
  • fnm 1.35.1 (latest 1.35.x release)

Tested Node.js versions: 16.20.2 (Maintenance LTS), 18.18.0 (Active LTS), 20.8.0 (Current). Each tool had all three versions pre-installed for warm switch tests, and no instances of 16.20.2 for cold switch tests.

Methodology

We used hyperfine 1.18.0 to run benchmarks, with 50 timed runs per test (10 warmup runs discarded). Measured time includes the full duration from command execution to the correct Node.js version being returned by node -v. We tested three core operations:

  1. Warm Switch: Switch to an already installed Node.js version (18.18.0 → 20.8.0)
  2. Cold Switch: Switch to a not-yet-installed Node.js version (triggers download and install)
  3. List Installed: List all installed Node.js versions via the tool's list command

Results

Warm Switch Speed (Already Installed Versions)

Tool

Mean Time

Median Time

P95 Time

fnm 1.35

12ms

11ms

15ms

nvm 0.40

89ms

87ms

102ms

asdf 0.10

156ms

152ms

178ms

Cold Switch Speed (Install + Switch)

Tool

Mean Time

Median Time

P95 Time

fnm 1.35

2.1s

2.0s

2.3s

nvm 0.40

4.8s

4.7s

5.1s

asdf 0.10

5.3s

5.2s

5.6s

List Installed Versions Speed

Tool

Mean Time

Median Time

P95 Time

fnm 1.35

8ms

7ms

10ms

nvm 0.40

45ms

43ms

52ms

asdf 0.10

62ms

60ms

71ms

Analysis

fnm outperformed both tools across all tests, with warm switch times 7x faster than nvm and 13x faster than asdf. Its Rust-based implementation and prebuilt binary caching eliminate the overhead of bash script execution that slows nvm. asdf trails both tools due to its general-purpose plugin architecture: the Node.js plugin adds an extra layer of abstraction compared to native Node-focused tools.

For cold switches (first-time installs), fnm is 2.3x faster than nvm and 2.5x faster than asdf, thanks to its parallel download and optimized binary extraction logic.

Conclusion

Choose fnm 1.35 if speed is your top priority: it delivers the fastest version switching for Node.js, with cross-platform support for macOS, Windows, and Linux. nvm 0.40 remains a solid choice for developers who need maximum ecosystem compatibility, especially for legacy projects, though it is limited to Unix-like systems (separate nvm-windows exists). asdf 0.10 is best for developers managing versions of multiple languages (e.g., Node.js, Python, Ruby) who can tolerate slightly slower Node.js-specific operations for unified workflow.

All benchmarks were run on macOS; Windows and Linux results may vary slightly, but relative performance between tools is consistent across platforms.

Top comments (0)