Skip to content

bench: reuse sent_packets buffers so the heap is not trimmed - #4414

Open
larseggert wants to merge 1 commit into
mainfrom
bench-sent-packets-reuse
Open

larseggert wants to merge 1 commit into
mainfrom
bench-sent-packets-reuse

Conversation

@larseggert

Copy link
Copy Markdown
Collaborator

Freeing a sent::Packets buffer per iteration lets glibc trim the heap, which the next timed iteration then faults back in.

@larseggert
larseggert marked this pull request as ready for review November 23, 2026 15:20
Copilot AI balanced review requested due to automatic review settings November 23, 2026 15:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the changes that reduce allocator noise by reusing benchmark buffers.

No open issues 🎉

What changed in this PR

This PR reduces allocator-related noise in Neqo’s sent-packet benchmarks by reusing buffers between iterations, avoiding heap trimming and subsequent page faults in timed work.

Changes:

  • Adds a shared buffer pool and a wrapper that returns packet storage to the pool when dropped.
  • Updates take_ranges, track, and remove_expired benchmarks to reuse storage, switching track to borrowed batched inputs.
File Description
neqo-transport/​benches/​sent_packets.rs Pools and reuses packet buffers across benchmark iterations.

Review effort: Balanced

@codecov

codecov Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.61%. Comparing base (6ae0599) to head (204a6f1).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4414      +/-   ##
==========================================
- Coverage   96.61%   96.61%   -0.01%     
==========================================
  Files         118      118              
  Lines       43894    43894              
  Branches    43894    43894              
==========================================
- Hits        42410    42406       -4     
- Misses       1463     1467       +4     
  Partials       21       21              
Flag Coverage Δ
freebsd 94.12% <ø> (+10.33%) ⬆️
linux 96.76% <ø> (-0.02%) ⬇️
macos 94.50% <ø> (ø)
windows 94.56% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
neqo-common 99.33% <ø> (+0.04%) ⬆️
neqo-http3 96.00% <ø> (ø)
neqo-qpack 96.55% <ø> (ø)
neqo-transport 97.11% <ø> (-0.03%) ⬇️
neqo-udp 87.63% <ø> (ø)
mtu 91.31% <ø> (ø)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No findings.

@github-actions

Copy link
Copy Markdown
Contributor

Failed Interop Tests

QUIC Interop Runner, client vs. server, differences relative to main at c46d346.

neqo-pr as clientneqo-pr as server
neqo-pr vs. aioquic: run cancelled after 20 min
neqo-pr vs. go-x-net: BP BA
neqo-pr vs. haproxy: BP BA
neqo-pr vs. kwik: run cancelled after 20 min
neqo-pr vs. linuxquic: run cancelled after 20 min
neqo-pr vs. lsquic: run cancelled after 20 min
neqo-pr vs. msquic: run cancelled after 20 min
neqo-pr vs. mvfst: run cancelled after 20 min
neqo-pr vs. neqo: run cancelled after 20 min
neqo-pr vs. nginx: baseline result missing
neqo-pr vs. ngtcp2: baseline result missing
neqo-pr vs. picoquic: A 🚀BA ⚠️C1 BP
neqo-pr vs. quic-go: A
neqo-pr vs. quic-zig: run cancelled after 20 min
neqo-pr vs. quiche: baseline result missing
neqo-pr vs. quinn: baseline result missing
neqo-pr vs. rama: run cancelled after 20 min
neqo-pr vs. s2n-quic: CM
neqo-pr vs. tquic: S BP BA
neqo-pr vs. xquic: Z A 🚀L1 ⚠️C1
aioquic vs. neqo-pr: baseline result missing
chrome vs. neqo-pr: baseline result missing
go-x-net vs. neqo-pr: CM
kwik vs. neqo-pr: CM
linuxquic vs. neqo-pr: run cancelled after 20 min
msquic vs. neqo-pr: run cancelled after 20 min
mvfst vs. neqo-pr: run cancelled after 20 min
neqo vs. neqo-pr: ⚠️Z A
ngtcp2 vs. neqo-pr: run cancelled after 20 min
openssl vs. neqo-pr: LR M A CM
quic-go vs. neqo-pr: CM
quic-zig vs. neqo-pr: baseline result missing
quiche vs. neqo-pr: baseline result missing
quinn vs. neqo-pr: 🚀C1 ⚠️L1 V2 CM
s2n-quic vs. neqo-pr: baseline result missing
tquic vs. neqo-pr: baseline result missing
xquic vs. neqo-pr: run cancelled after 20 min
All results

Succeeded Interop Tests

QUIC Interop Runner, client vs. server

neqo-pr as client

neqo-pr as server

Unsupported Interop Tests

QUIC Interop Runner, client vs. server

neqo-pr as client

neqo-pr as server

@github-actions

Copy link
Copy Markdown
Contributor

Client/server transfer results

Performance differences relative to c46d346.

Transfer of 33554432 bytes over loopback, min. 100 runs. All unit-less numbers are in milliseconds.

Client vs. server Mean±σ Min–Max Median±MAD MiB/s±σ ΔMedian
neqo-neqo-cubic-nopacing 24.0 ± 0.1 23.7 – 24.3 24.0 ± 0.1 1334.9 ± 5.7 💔 +0.6 (+2.5%)

Table above only shows statistically significant changes. See all results below.

All results

Transfer of 33554432 bytes over loopback, min. 100 runs. All unit-less numbers are in milliseconds.

Client vs. server Mean±σ Min–Max Median±MAD MiB/s±σ ΔMedian
google-google 157.3 ± 0.5 156.2 – 158.8 157.3 ± 0.4 203.4 ± 0.7
google-neqo-cubic 79.8 ± 0.4 78.9 – 80.7 79.7 ± 0.4 401.2 ± 1.8 +0.6 (+0.8%)
neqo-google-cubic 244.3 ± 35.3 203.6 – 313.6 247.4 ± 54.8 131.0 ± 18.9 +36.0 (+17.0%)
neqo-neqo-cubic 24.1 ± 0.2 23.7 – 24.6 24.0 ± 0.2 1329.7 ± 10.0 +0.1 (+0.4%)
neqo-neqo-cubic-nopacing 24.0 ± 0.1 23.7 – 24.3 24.0 ± 0.1 1334.9 ± 5.7 💔 +0.6 (+2.5%)
neqo-neqo-newreno 24.0 ± 0.2 23.5 – 24.5 24.0 ± 0.2 1333.9 ± 9.8 +0.0 (+0.2%)
neqo-neqo-newreno-nopacing 23.3 ± 0.1 23.1 – 24.0 23.3 ± 0.1 1373.2 ± 8.0 -0.0 (-0.0%)
neqo-quiche-cubic 35.3 ± 0.4 34.6 – 36.3 35.3 ± 0.4 905.9 ± 9.4 +0.2 (+0.7%)
neqo-s2n-cubic 45.5 ± 0.2 45.0 – 46.0 45.4 ± 0.2 704.1 ± 3.5 -0.0 (-0.0%)
quiche-neqo-cubic 36.4 ± 0.5 34.9 – 37.8 36.4 ± 0.5 879.5 ± 11.6 +0.0 (+0.1%)
quiche-quiche 42.3 ± 0.3 41.6 – 42.9 42.3 ± 0.4 756.5 ± 5.6
s2n-neqo-cubic 126.9 ± 0.5 125.5 – 128.4 126.9 ± 0.5 252.2 ± 1.1 +0.1 (+0.1%)
s2n-s2n ⚠️ 178.1 ± 28.6 147.4 – 271.4 171.6 ± 1.4 179.6 ± 28.8

Download data for profiler.firefox.com or download performance comparison data.

@codspeed

codspeed Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will degrade performance by 0.69%

1 warning

⚠️ 1 benchmark is dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚡ 2 improved benchmarks
❌ 4 regressed benchmarks
✅ 95 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Walltime walltime/pacing-true/varying-seeds 3.8 ms 3.9 ms -3.85%
❌ Walltime walltime/pacing-false/same-seed 3.4 ms 3.5 ms -3.17%
❌ Walltime neqo-neqo-cubic 25.5 ms 26.3 ms -3.01%
❌ Walltime walltime/pacing-true/same-seed 4 ms 4.1 ms -2.12%
⚡ Walltime 1-conn/10_000-parallel-1b-resp (aka. RPS) 87.2 ms 83.5 ms +4.44%
⚡ CPU Simulation track 254.9 µs 245.2 µs +3.95%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing bench-sent-packets-reuse (204a6f1) with main (c46d346)

Open in CodSpeed

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark results

No significant performance differences relative to c46d346.

All results
transfer/1-conn/1-100mb-req (aka. Upload)/mtu-1500
       time:   [61.450 ms 61.492 ms 61.535 ms]
       thrpt:  [1.5870 GiB/s 1.5881 GiB/s 1.5892 GiB/s]
transfer/1-conn/1-100mb-resp (aka. Download)/mtu-1500
       time:   [61.572 ms 61.636 ms 61.711 ms]
       thrpt:  [1.5825 GiB/s 1.5844 GiB/s 1.5860 GiB/s]
Found 3 outliers among 100 measurements (3.00%)
1 (1.00%) high mild
2 (2.00%) high severe
transfer/1-conn/1-1b-resp (aka. HPS)/mtu-1500
       time:   [3.8071 ms 3.8081 ms 3.8091 ms]
       thrpt:  [262.53   B/s 262.60   B/s 262.67   B/s]
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild
transfer/1-conn/10_000-parallel-1b-resp (aka. RPS)/mtu-1500
       time:   [88.051 ms 88.212 ms 88.374 ms]
       thrpt:  [113.16 Kelem/s 113.36 Kelem/s 113.57 Kelem/s]
streams-flow-controlled/walltime/1-streams/each-4194304-bytes
       time:   [13.330 ms 13.334 ms 13.338 ms]
       thrpt:  [299.90 MiB/s 299.99 MiB/s 300.08 MiB/s]
Found 2 outliers among 100 measurements (2.00%)
1 (1.00%) low mild
1 (1.00%) high mild
streams-flow-controlled/walltime/10-streams/each-1048576-bytes
       time:   [36.065 ms 36.113 ms 36.158 ms]
       thrpt:  [276.56 MiB/s 276.91 MiB/s 277.28 MiB/s]
Found 14 outliers among 100 measurements (14.00%)
1 (1.00%) low severe
13 (13.00%) low mild
streams/walltime/1-streams/each-1000-bytes
       time:   [162.01 µs 162.69 µs 163.56 µs]
       thrpt:  [5.8307 MiB/s 5.8619 MiB/s 5.8866 MiB/s]
Found 2 outliers among 100 measurements (2.00%)
2 (2.00%) high mild
streams/walltime/1000-streams/each-1-bytes
       time:   [4.7801 ms 4.7820 ms 4.7838 ms]
       thrpt:  [204.14 KiB/s 204.22 KiB/s 204.30 KiB/s]
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) low mild
streams/walltime/1000-streams/each-1000-bytes
       time:   [15.316 ms 15.325 ms 15.334 ms]
       thrpt:  [62.194 MiB/s 62.230 MiB/s 62.267 MiB/s]
Found 7 outliers among 100 measurements (7.00%)
5 (5.00%) low mild
2 (2.00%) high mild
transfer/walltime/pacing-false/same-seed
       time:   [3.4361 ms 3.4383 ms 3.4404 ms]
       thrpt:  [1.1354 GiB/s 1.1361 GiB/s 1.1368 GiB/s]
transfer/walltime/pacing-false/varying-seeds
       time:   [3.5050 ms 3.5070 ms 3.5094 ms]
       thrpt:  [1.1131 GiB/s 1.1138 GiB/s 1.1145 GiB/s]
transfer/walltime/pacing-true/same-seed
       time:   [3.8136 ms 3.8163 ms 3.8196 ms]
       thrpt:  [1.0227 GiB/s 1.0236 GiB/s 1.0243 GiB/s]
transfer/walltime/pacing-true/varying-seeds
       time:   [3.9921 ms 3.9945 ms 3.9975 ms]
       thrpt:  [1000.6 MiB/s 1001.4 MiB/s 1002.0 MiB/s]

Instructions per cycle

Criterion reported no significant timing changes.

All benchmarks
Benchmark IPC before IPC after ΔIPC
streams-flow-controlled/walltime/1-streams/each-4194304-bytes 2.81 2.92 +4.0%
streams-flow-controlled/walltime/10-streams/each-1048576-bytes 3.06 3.13 +2.2%
transfer/walltime/pacing-false/same-seed 2.86 2.88 +0.6%
transfer/walltime/pacing-true/same-seed 2.89 2.87 -0.5%
streams/walltime/1000-streams/each-1-bytes 3.27 3.26 -0.5%
streams/walltime/1000-streams/each-1000-bytes 2.95 2.94 -0.5%
transfer/1-conn/10_000-parallel-1b-resp (aka. RPS)/mtu-1500 3.21 3.22 +0.3%
transfer/1-conn/1-100mb-resp (aka. Download)/mtu-1500 3.11 3.10 -0.2%
transfer/1-conn/1-1b-resp (aka. HPS)/mtu-1500 2.25 2.25 +0.2%
transfer/1-conn/1-100mb-req (aka. Upload)/mtu-1500 3.08 3.08 -0.1%
transfer/walltime/pacing-true/varying-seeds 2.88 2.88 +0.1%
transfer/walltime/pacing-false/varying-seeds 2.87 2.87 +0.0%
streams/walltime/1-streams/each-1000-bytes 2.57 2.57 -0.0%
Profiles for profiler.firefox.com (64)

Download data for profiler.firefox.com or download performance comparison data.

This branch has not been deployed

No deployments
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.

2 participants