Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: switch back to protobufjs #310

Merged
merged 4 commits into from
Aug 2, 2022
Merged

feat: switch back to protobufjs #310

merged 4 commits into from
Aug 2, 2022

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Aug 1, 2022

Motivation

Description

  • Switch back to protobufjs
  • Copy generated files from v1.0.0
  • Change rpc.js to rpc.cjs, new rpc.js to reexport RPC from rpc.js

@twoeths twoeths changed the title Switch back to protobufjs feat: switch back to protobufjs Aug 1, 2022
@twoeths twoeths marked this pull request as ready for review August 1, 2022 08:18
@twoeths twoeths requested a review from a team as a code owner August 1, 2022 08:18
@mpetrunic
Copy link
Member

@tuyennhv have you tried with new versions of protons?https://github.com/ipfs/protons/releases/tag/protons-v4.0.1
ipfs/protons@protons-runtime-v2.0.1...protons-runtime-v2.0.2

should have performance optimizations

@@ -1 +0,0 @@
export * from './rpc.js'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need this file for the subpath export (import ... from '@chainsafe/libp2p-gossipsub/message')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this is exactly what I got when I build lodestar 👍

@codecov-commenter
Copy link

codecov-commenter commented Aug 2, 2022

Codecov Report

Merging #310 (bef99b6) into master (e0d3a7d) will decrease coverage by 1.70%.
The diff coverage is 71.02%.

@@            Coverage Diff             @@
##           master     #310      +/-   ##
==========================================
- Coverage   81.53%   79.83%   -1.71%     
==========================================
  Files          43       44       +1     
  Lines        9501    11044    +1543     
  Branches      918     1014      +96     
==========================================
+ Hits         7747     8817    +1070     
- Misses       1754     2227     +473     
Impacted Files Coverage Δ
src/metrics.ts 23.08% <6.66%> (ø)
src/index.ts 70.82% <68.75%> (+0.03%) ⬆️
src/message/rpc.cjs 71.28% <71.28%> (ø)
src/message-cache.ts 79.09% <100.00%> (ø)
src/message/rpc.js 100.00% <100.00%> (ø)
src/types.ts 95.13% <100.00%> (ø)
src/utils/buildRawMessage.ts 84.39% <100.00%> (ø)
src/utils/create-gossip-rpc.ts 100.00% <100.00%> (ø)
test/message-cache.spec.ts 100.00% <100.00%> (ø)
test/utils/index.ts 100.00% <100.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e0d3a7d...bef99b6. Read the comment docs.

@twoeths
Copy link
Contributor Author

twoeths commented Aug 2, 2022

@tuyennhv have you tried with new versions of protons?https://github.com/ipfs/protons/releases/tag/protons-v4.0.1
ipfs/protons@protons-runtime-v2.0.1...protons-runtime-v2.0.2

@mpetrunic I've tried it, below is the result:

  • current protons
rpc
    ✔ decode Attestation message                                           7089685 ops/s    141.0500 ns/op        -    2045205 runs   30.1 s
  • new protons (v4.0) & protons-runtimes (v2.0)
rpc
    ✔ decode Attestation message                                           6807815 ops/s    146.8900 ns/op        -    1977187 runs   30.1 s
  • protobufjs
rpc
    ✔ decode Attestation message using protobufjs                      1.315789e+8 ops/s    7.600000 ns/op        -   28030718 runs   30.0 s

=> there is no improvement made with new protons and it's still 20x slower than protobufjs

Copy link
Contributor

@dapplion dapplion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@wemeetagain wemeetagain merged commit 64b40fc into master Aug 2, 2022
@wemeetagain wemeetagain deleted the tuyen/protobufjs branch August 2, 2022 14:49
@achingbrain
Copy link
Collaborator

there is no improvement made with new protons and it's still 20x slower than protobufjs

Can you please share the benchmarks you're using to make these measurements?

@twoeths twoeths mentioned this pull request Aug 9, 2022
@twoeths
Copy link
Contributor Author

twoeths commented Aug 9, 2022

there is no improvement made with new protons and it's still 20x slower than protobufjs

Can you please share the benchmarks you're using to make these measurements?

@achingbrain the benchmark is in #318

twoeths added a commit that referenced this pull request Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants