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

p2p/rlpx: reduce allocation and syscalls #22899

Merged
merged 7 commits into from
May 27, 2021
Merged

Commits on May 21, 2021

  1. p2p/rlpx: add benchmarks

    fjl committed May 21, 2021
    Configuration menu
    Copy the full SHA
    6fe8c25 View commit details
    Browse the repository at this point in the history
  2. rlp: add IntSize

    fjl committed May 21, 2021
    Configuration menu
    Copy the full SHA
    678e5ef View commit details
    Browse the repository at this point in the history
  3. p2p: copy message data on read

    This is the minimal necessary change to make the next commit work.
    fjl committed May 21, 2021
    Configuration menu
    Copy the full SHA
    bf726d1 View commit details
    Browse the repository at this point in the history
  4. p2p/rlpx: reduce allocation and syscalls

    This change significantly improves the performance of RLPx message reads
    and writes. In the previous implementation, reading and writing of
    message frames performed multiple reads and writes on the underlying
    network connection, and allocated a new []byte buffer for every read.
    
    In the new implementation, reads and writes re-use buffers, and perform
    much fewer system calls on the underlying connection. This effectively
    doubles the theoretically achievable throughput on a single connection,
    as shown by the benchmark result:
    
        name             old speed      new speed       delta
        Throughput-8     66.5MB/s ± 0%  139.7MB/s ± 1%  +110.16%  (p=0.001 n=7+7)
    
    The change also removes support for the legacy, pre-EIP-8 handshake encoding.
    As of May 2021, no actively maintained client sends this format.
    fjl committed May 21, 2021
    Configuration menu
    Copy the full SHA
    fc966ca View commit details
    Browse the repository at this point in the history
  5. p2p/rlpx: rename uint24 functions

    fjl committed May 21, 2021
    Configuration menu
    Copy the full SHA
    b459810 View commit details
    Browse the repository at this point in the history
  6. p2p/rlpx: fix snappy buffer handling

    The snappy functions only check the length of the destination buffer and
    ignore its capacity. When message sizes alternated between large and
    small, we would still allocate a new buffer for every other message.
    This fixes it.
    fjl committed May 21, 2021
    Configuration menu
    Copy the full SHA
    6375417 View commit details
    Browse the repository at this point in the history

Commits on May 25, 2021

  1. Configuration menu
    Copy the full SHA
    deebb34 View commit details
    Browse the repository at this point in the history