zhangyuang / napi-wasm-bench

A performance benchmark for wasm and napi in Node.js with the same code

Repository from Github https://github.comzhangyuang/napi-wasm-benchRepository from Github https://github.comzhangyuang/napi-wasm-bench

performance-demo

npm install
npm run build
npm run benchmark

Result

$ node benchmark.js
Running "String Processing Benchmark" suite...
Progress: 100%

  WASM Implementation:
    17 136 ops/s, ±4.47%   | slowest, 43.56% slower

  N-API Implementation:
    30 362 ops/s, ±1.15%   | fastest

Finished 2 cases!
  Fastest: N-API Implementation
  Slowest: WASM Implementation

About

A performance benchmark for wasm and napi in Node.js with the same code


Languages

Language:Rust 38.9%Language:JavaScript 38.2%Language:HTML 22.9%