Skip to content

Slow compared to protobufjs #51

@wemeetagain

Description

@wemeetagain

Running a simple benchmark against gossipsub RPC encoding/decoding from before and after switching from protobufjs to protons shows a significant degradation in performance. ~20x slower encoding, ~10x slower decoding.

The performance degradation is serious enough that (js-libp2p-gossipsub) may need to either switch from this library or determine a refactor here that can achieve comparable results.

with protobufjs:

  RPC
    ✔ encode                                                              401606.4 ops/s    2.490000 us/op        -   22116142 runs   60.8 s
    ✔ decode                                                              452284.0 ops/s    2.211000 us/op        -   24709315 runs   60.9 s

with protons:

  RPC
    ✔ encode                                                              24618.41 ops/s    40.62000 us/op        -    1458781 runs   60.1 s
    ✔ decode                                                              41540.31 ops/s    24.07300 us/op        -    2439588 runs   60.0 s

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions