Protobuf to ts transpiler
$ git clone git@github.com:ipfs/protons.git
$ cd protons
$ npm i
$ npm run build
$ cd packages/protons-benchmark
Run the benchmark suite in node:
$ npm start
> protons-benchmark@0.0.0 prestart
> npm run build
> protons-benchmark@0.0.0 build
> aegir build --no-bundle && cp -R src/protobufjs dist/src/protobufjs
[15:02:28] tsc [started]
[15:02:32] tsc [completed]
> protons-benchmark@0.0.0 start
> node dist/src/implementations/index.js
pbjs x 19,188 ops/sec ±0.38% (98 runs sampled)
protons x 19,001 ops/sec ±0.33% (95 runs sampled)
protobuf.js x 19,558 ops/sec ±0.30% (91 runs sampled)
@protobuf-ts x 17,216 ops/sec ±0.32% (95 runs sampled)
protobuf-es x 15,673 ops/sec ±0.48% (93 runs sampled)
Fastest is protobuf.js
Or in a Deno:
$ npm run start:deno
> protons-benchmark@0.0.0 start:deno
> deno --allow-env dist/src/implementations/index.js
pbjs x 20,665 ops/sec ±0.55% (93 runs sampled)
protons x 19,791 ops/sec ±0.51% (95 runs sampled)
protobuf.js x 20,222 ops/sec ±0.56% (93 runs sampled)
@protobuf-ts x 18,185 ops/sec ±0.62% (95 runs sampled)
protobuf-es x 18,327 ops/sec ±0.68% (92 runs sampled)
Fastest is pbjs
Or in a Bun:
$ npm run start:bun
> protons-benchmark@0.0.0 start:bun
> bun dist/src/implementations/index.js
pbjs x 28,574 ops/sec ±0.59% (91 runs sampled)
protons x 28,162 ops/sec ±0.53% (92 runs sampled)
protobuf.js x 27,920 ops/sec ±0.83% (97 runs sampled)
@protobuf-ts x 26,250 ops/sec ±0.96% (93 runs sampled)
protobuf-es x 25,727 ops/sec ±0.51% (94 runs sampled)
Fastest is pbjs
Or in a browser:
$ npm run start:browser
> protons-benchmark@0.0.0 start:browser
> npx playwright-test dist/src/index.js --runner benchmark
✔ chromium set up
pbjs x 19,763 ops/sec ±0.35% (67 runs sampled)
protons x 19,617 ops/sec ±0.37% (68 runs sampled)
protobuf.js x 19,772 ops/sec ±0.34% (67 runs sampled)
@protobuf-ts x 17,204 ops/sec ±0.33% (69 runs sampled)
protobuf-es x 16,032 ops/sec ±0.38% (68 runs sampled)
Fastest is protobuf.js,pbjs
Licensed under either of
Contributions welcome! Please check out the issues.
Also see our contributing document for more information on how we work, and about contributing in general.
Please be aware that all interactions related to this repo are subject to the IPFS Code of Conduct.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.