mozilla / neqo

Neqo, the Mozilla Firefox implementation of QUIC in Rust
https://firefox-source-docs.mozilla.org/networking/http/http3.html
Apache License 2.0
1.85k stars 124 forks source link

perf(transport): have add_datagram take Vec<u8> #2120

Closed mxinden closed 2 months ago

mxinden commented 2 months ago

add_datagram takes a Quic datagram and adds it to the queue of datagrams to be sent out. Previously it would take a reference (i.e. &[u8]) and would allocate it into a new Vec<u8> before enqueuing. At the call-site the original allocation (referenced by the &[u8]) would go out-of-scope and thus be de-allocated. This is a wasted allocation for each Quic datagram to be send.

This commit has the call-site pass the owned Vec<u8> down right away.

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.31%. Comparing base (75372c2) to head (d2603d5).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2120 +/- ## ========================================== - Coverage 95.32% 95.31% -0.01% ========================================== Files 112 112 Lines 36319 36316 -3 ========================================== - Hits 34621 34615 -6 - Misses 1698 1701 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 2 months ago

Failed Interop Tests

QUIC Interop Runner, client vs. server

neqo-latest as client

Succeeded Interop Tests

QUIC Interop Runner, client vs. server

neqo-latest as client

github-actions[bot] commented 2 months ago

Benchmark results

Performance differences relative to b780e5331e6e61a87b05d342128fdf4d6f7e06b4.

coalesce_acked_from_zero 1+1 entries: No change in performance detected.
       time:   [99.506 ns 99.840 ns 100.18 ns]
       change: [-0.3972% +0.3129% +0.8999%] (p = 0.38 > 0.05)

Found 13 outliers among 100 measurements (13.00%)
  8 (8.00%) high mild
  5 (5.00%) high severe
coalesce_acked_from_zero 3+1 entries: No change in performance detected.
       time:   [117.19 ns 117.55 ns 117.94 ns]
       change: [-0.5740% -0.0443% +0.4019%] (p = 0.87 > 0.05)

Found 13 outliers among 100 measurements (13.00%)
  1 (1.00%) low mild
  1 (1.00%) high mild
  11 (11.00%) high severe
coalesce_acked_from_zero 10+1 entries: No change in performance detected.
       time:   [116.78 ns 117.19 ns 117.68 ns]
       change: [-0.6992% -0.1123% +0.4395%] (p = 0.71 > 0.05)

Found 12 outliers among 100 measurements (12.00%)
  1 (1.00%) low severe
  4 (4.00%) low mild
  2 (2.00%) high mild
  5 (5.00%) high severe
coalesce_acked_from_zero 1000+1 entries: No change in performance detected.
       time:   [96.989 ns 97.146 ns 97.323 ns]
       change: [-0.8335% -0.0881% +0.7050%] (p = 0.84 > 0.05)

Found 6 outliers among 100 measurements (6.00%)
  2 (2.00%) high mild
  4 (4.00%) high severe
RxStreamOrderer::inbound_frame(): No change in performance detected.
       time:   [110.97 ms 111.10 ms 111.33 ms]
       change: [-0.0860% +0.1653% +0.4044%] (p = 0.22 > 0.05)

Found 11 outliers among 100 measurements (11.00%)
  8 (8.00%) low mild
  2 (2.00%) high mild
  1 (1.00%) high severe
transfer/pacing-false/varying-seeds: No change in performance detected.
       time:   [25.883 ms 26.792 ms 27.688 ms]
       change: [-6.3449% -1.6427% +3.3262%] (p = 0.50 > 0.05)
transfer/pacing-true/varying-seeds: No change in performance detected.
       time:   [34.175 ms 35.933 ms 37.725 ms]
       change: [-10.937% -4.4610% +2.4717%] (p = 0.20 > 0.05)

Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
transfer/pacing-false/same-seed: No change in performance detected.
       time:   [31.879 ms 32.563 ms 33.223 ms]
       change: [-1.7419% +1.4026% +4.5902%] (p = 0.38 > 0.05)

Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) low mild
transfer/pacing-true/same-seed: No change in performance detected.
       time:   [37.088 ms 39.936 ms 42.827 ms]
       change: [-15.168% -6.3307% +3.0117%] (p = 0.17 > 0.05)
1-conn/1-100mb-resp (aka. Download)/client: No change in performance detected.
       time:   [113.31 ms 113.69 ms 114.05 ms]
       thrpt:  [876.81 MiB/s 879.60 MiB/s 882.56 MiB/s]
change:
       time:   [-0.5780% -0.1062% +0.3695%] (p = 0.66 > 0.05)
       thrpt:  [-0.3681% +0.1063% +0.5813%]

Found 2 outliers among 100 measurements (2.00%)
  1 (1.00%) low severe
  1 (1.00%) low mild
1-conn/10_000-parallel-1b-resp (aka. RPS)/client: No change in performance detected.
       time:   [313.57 ms 317.02 ms 320.50 ms]
       thrpt:  [31.201 Kelem/s 31.543 Kelem/s 31.891 Kelem/s]
change:
       time:   [-1.4297% +0.1767% +1.7310%] (p = 0.83 > 0.05)
       thrpt:  [-1.7015% -0.1763% +1.4505%]
1-conn/1-1b-resp (aka. HPS)/client: No change in performance detected.
       time:   [34.126 ms 34.338 ms 34.566 ms]
       thrpt:  [28.931  elem/s 29.122  elem/s 29.303  elem/s]
change:
       time:   [-1.3284% -0.3843% +0.4900%] (p = 0.42 > 0.05)
       thrpt:  [-0.4876% +0.3858% +1.3463%]

Found 4 outliers among 100 measurements (4.00%)
  4 (4.00%) high mild

Client/server transfer results

Transfer of 33554432 bytes over loopback. Client Server CC Pacing Mean [ms] Min [ms] Max [ms] Relative
msquic msquic 173.6 ± 108.1 98.4 519.5 1.00
neqo msquic reno on 238.5 ± 41.9 205.5 353.3 1.00
neqo msquic reno 239.3 ± 61.3 209.6 448.5 1.00
neqo msquic cubic on 240.9 ± 56.4 213.8 416.4 1.00
neqo msquic cubic 262.3 ± 85.2 214.6 469.3 1.00
msquic neqo reno on 158.0 ± 88.7 85.6 355.4 1.00
msquic neqo reno 128.1 ± 79.4 81.1 354.3 1.00
msquic neqo cubic on 146.5 ± 80.4 86.0 329.3 1.00
msquic neqo cubic 139.7 ± 92.1 82.5 503.9 1.00
neqo neqo reno on 152.1 ± 16.0 123.8 175.7 1.00
neqo neqo reno 201.8 ± 86.4 130.2 408.7 1.00
neqo neqo cubic on 192.0 ± 67.7 128.8 380.7 1.00
neqo neqo cubic 246.3 ± 129.1 134.9 582.3 1.00

:arrow_down: Download logs

github-actions[bot] commented 2 months ago

Firefox builds for this PR

The following builds are available for testing. Crossed-out builds did not succeed.