Skip to content

Performance ​

Benchmarked with Vitest's benchmark API on Node.js 24, with fetch mocked to eliminate network variance. Run npm run bench in the repository to reproduce on your machine.

Why is ofetch faster on the baseline?

ofetch is a minimal wrapper with no built-in retry, hook system or schema validation. valifetch bundles all of that, so the gap reflects features, not inefficiency. Schema validation itself adds roughly 10-15% overhead over valifetch's own baseline.

GET + JSON parse (no schema) ​

Libraryops/secvs valifetch
ofetch192,5291.86× faster
valifetch103,649baseline
up-fetch54,5821.90× slower
ky49,3882.10× slower
axios (fetch adapter)26,9333.85× slower

GET + JSON parse + schema validation ​

Only valifetch and up-fetch support schema validation natively. ky, ofetch and axios would require a manual parse step on top of their baseline cost.

Libraryops/secvs valifetch
valifetch + valibot90,743baseline
up-fetch + valibot46,9781.93× slower

POST with JSON body ​

Libraryops/secvs valifetch
ofetch139,5271.89× faster
valifetch73,777baseline
up-fetch41,7021.77× slower
ky22,8813.22× slower
axios (fetch adapter)22,3183.31× slower

4xx error path ​

Libraryops/secvs valifetch
ofetch55,6541.55× faster
up-fetch49,6981.39× faster
valifetch35,792baseline
ky27,0381.32× slower
axios (fetch adapter)11,6663.07× slower

axios constructs a full AxiosError with a deep copy of the request config on every error, which explains the roughly 3× gap.

Coming from another client? See the migration guides for ky and axios.

Released under the MIT License. Built with Claude Code.