Skip to content

perf(transport): don't build and drop an Error per decoded frame field - #4416

Open
larseggert wants to merge 1 commit into
mainfrom
perf-frame-decode-no-error-drop
Open

larseggert wants to merge 1 commit into
mainfrom
perf-frame-decode-no-error-drop

Conversation

@larseggert

Copy link
Copy Markdown
Collaborator

ok_or builds the Error even when the value is present and then drops it; let ... else avoids that.

@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 were identified for the QUIC frame-decoding optimization.

No open issues 🎉

What changed in this PR

This PR optimizes QUIC frame decoding by constructing Error::FrameEncoding only when a decoded value is missing, preserving existing success and error behavior.

Changes:

  • Replaces eager ok_or error construction with let ... else.
  • Adds a comment explaining why ok_or is avoided.
File Description
neqo-transport/​src/​frame.rs Updates the decoding helper to avoid constructing and dropping an error for present values.

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.62%. Comparing base (6ae0599) to head (d3229b3).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4416   +/-   ##
=======================================
  Coverage   96.61%   96.62%           
=======================================
  Files         118      118           
  Lines       43894    43896    +2     
  Branches    43894    43896    +2     
=======================================
+ Hits        42410    42415    +5     
+ Misses       1463     1460    -3     
  Partials       21       21           
Flag Coverage Δ
freebsd 94.13% <100.00%> (+10.33%) ⬆️
linux 96.77% <100.00%> (-0.01%) ⬇️
macos 94.50% <100.00%> (-0.01%) ⬇️
windows 94.56% <100.00%> (+<0.01%) ⬆️

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.13% <100.00%> (+<0.01%) ⬆️
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: baseline result missing
neqo-pr vs. go-x-net: BP BA
neqo-pr vs. haproxy: BP BA
neqo-pr vs. kwik: 🚀M Z 3 ⚠️DC LR S R L1 C1 6 ⚠️BP
neqo-pr vs. linuxquic: ⚠️C1 CM
neqo-pr vs. lsquic: run cancelled after 20 min
neqo-pr vs. msquic: run cancelled after 20 min
neqo-pr vs. mvfst: H DC LR C20 M S R Z 3 B U E A L1 L2 C1 C2 6 V2 BP BA CM
neqo-pr vs. neqo: A
neqo-pr vs. nginx: BP BA
neqo-pr vs. ngtcp2: Z ⚠️L1 C1 CM
neqo-pr vs. picoquic: baseline result missing
neqo-pr vs. quic-go: A
neqo-pr vs. quic-zig: baseline result missing
neqo-pr vs. quiche: run cancelled after 20 min
neqo-pr vs. quinn: baseline result missing
neqo-pr vs. s2n-quic: run cancelled after 20 min
neqo-pr vs. tquic: run cancelled after 20 min
neqo-pr vs. xquic: run cancelled after 20 min
aioquic vs. neqo-pr: baseline result missing
go-x-net vs. neqo-pr: CM
kwik vs. neqo-pr: baseline result missing
lsquic vs. neqo-pr: run cancelled after 20 min
msquic vs. neqo-pr: CM
mvfst vs. neqo-pr: H DC LR C20 M S R Z 3 B U E A L1 L2 C1 C2 6 V2 BP BA CM
neqo vs. neqo-pr: run cancelled after 20 min
ngtcp2 vs. neqo-pr: run cancelled after 20 min
openssl vs. neqo-pr: run cancelled after 20 min
picoquic vs. neqo-pr: run cancelled after 20 min
quic-go vs. neqo-pr: run cancelled after 20 min
quic-zig vs. neqo-pr: CM
quiche vs. neqo-pr: run cancelled after 20 min
quinn vs. neqo-pr: L1 V2 CM
rama vs. neqo-pr: baseline result missing
s2n-quic vs. neqo-pr: CM
tquic vs. neqo-pr: run cancelled after 20 min
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

@codspeed

codspeed Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will regress 4 benchmarks

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

⚡ 4 improved benchmarks
❌ 4 regressed benchmarks
✅ 93 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 -4.51%
❌ Walltime walltime/pacing-false/same-seed 3.4 ms 3.5 ms -2.31%
❌ Walltime neqo-neqo-cubic 25.5 ms 26.1 ms -2.28%
❌ Walltime walltime/pacing-true/same-seed 4 ms 4.1 ms -2.18%
⚡ CPU Simulation decode 100 STREAM frames 26.2 µs 21 µs +24.67%
⚡ CPU Simulation decode 1000 STREAM frames 245.4 µs 197 µs +24.52%
⚡ CPU Simulation decode 10 STREAM frames 4.5 µs 3.6 µs +23.95%
⚡ Walltime 1-conn/10_000-parallel-1b-resp (aka. RPS) 87.2 ms 82.4 ms +5.89%

Tip

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


Comparing perf-frame-decode-no-error-drop (d3229b3) with main (c46d346)

Open in CodSpeed

@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
google-neqo-cubic 80.0 ± 0.6 78.6 – 81.3 80.1 ± 0.6 399.8 ± 3.1 💔 +1.6 (+2.0%)

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 156.2 ± 0.6 154.7 – 158.1 156.2 ± 0.6 204.9 ± 0.8
google-neqo-cubic 80.0 ± 0.6 78.6 – 81.3 80.1 ± 0.6 399.8 ± 3.1 💔 +1.6 (+2.0%)
neqo-google-cubic 247.6 ± 35.2 190.2 – 315.8 248.4 ± 46.1 129.2 ± 18.4 +5.8 (+2.4%)
neqo-neqo-cubic 24.0 ± 0.2 23.7 – 24.4 24.0 ± 0.2 1333.5 ± 8.8 +0.1 (+0.4%)
neqo-neqo-cubic-nopacing 23.3 ± 0.1 23.0 – 23.7 23.3 ± 0.1 1372.5 ± 6.3 -0.0 (-0.2%)
neqo-neqo-newreno 24.2 ± 0.2 23.9 – 24.5 24.2 ± 0.2 1322.1 ± 9.2 +0.2 (+0.8%)
neqo-neqo-newreno-nopacing 23.4 ± 0.1 23.2 – 23.8 23.4 ± 0.1 1367.8 ± 8.0 +0.0 (+0.2%)
neqo-quiche-cubic 35.1 ± 0.3 34.4 – 35.9 35.0 ± 0.3 912.7 ± 8.5 +0.1 (+0.2%)
neqo-s2n-cubic 45.4 ± 0.2 44.8 – 45.9 45.4 ± 0.3 705.6 ± 3.8 +0.1 (+0.2%)
quiche-neqo-cubic 36.6 ± 0.4 35.7 – 37.6 36.6 ± 0.4 873.8 ± 9.7 +0.1 (+0.4%)
quiche-quiche 43.4 ± 0.2 42.8 – 44.0 43.4 ± 0.2 737.8 ± 4.0
s2n-neqo-cubic 126.0 ± 0.6 124.8 – 128.1 125.8 ± 0.4 254.0 ± 1.2 -0.3 (-0.2%)
s2n-s2n ⚠️ 179.3 ± 30.3 148.4 – 296.3 171.6 ± 1.4 178.4 ± 30.2

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

@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:   [62.467 ms 62.513 ms 62.559 ms]
       thrpt:  [1.5610 GiB/s 1.5622 GiB/s 1.5633 GiB/s]
transfer/1-conn/1-100mb-resp (aka. Download)/mtu-1500
       time:   [63.336 ms 63.407 ms 63.481 ms]
       thrpt:  [1.5384 GiB/s 1.5401 GiB/s 1.5419 GiB/s]
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild
transfer/1-conn/1-1b-resp (aka. HPS)/mtu-1500
       time:   [3.8072 ms 3.8085 ms 3.8098 ms]
       thrpt:  [262.48   B/s 262.57   B/s 262.66   B/s]
Found 2 outliers among 100 measurements (2.00%)
2 (2.00%) high mild
transfer/1-conn/10_000-parallel-1b-resp (aka. RPS)/mtu-1500
       time:   [87.388 ms 87.539 ms 87.693 ms]
       thrpt:  [114.03 Kelem/s 114.23 Kelem/s 114.43 Kelem/s]
streams-flow-controlled/walltime/1-streams/each-4194304-bytes
       time:   [13.314 ms 13.332 ms 13.348 ms]
       thrpt:  [299.68 MiB/s 300.04 MiB/s 300.43 MiB/s]
Found 11 outliers among 100 measurements (11.00%)
11 (11.00%) low mild
streams-flow-controlled/walltime/10-streams/each-1048576-bytes
       time:   [35.403 ms 35.450 ms 35.496 ms]
       thrpt:  [281.72 MiB/s 282.09 MiB/s 282.47 MiB/s]
streams/walltime/1-streams/each-1000-bytes
       time:   [163.60 µs 164.31 µs 165.20 µs]
       thrpt:  [5.7730 MiB/s 5.8042 MiB/s 5.8292 MiB/s]
Found 2 outliers among 100 measurements (2.00%)
2 (2.00%) high mild
streams/walltime/1000-streams/each-1-bytes
       time:   [4.7780 ms 4.7795 ms 4.7810 ms]
       thrpt:  [204.26 KiB/s 204.32 KiB/s 204.39 KiB/s]
streams/walltime/1000-streams/each-1000-bytes
       time:   [15.305 ms 15.315 ms 15.324 ms]
       thrpt:  [62.234 MiB/s 62.271 MiB/s 62.310 MiB/s]
Found 8 outliers among 100 measurements (8.00%)
8 (8.00%) low mild
transfer/walltime/pacing-false/same-seed
       time:   [3.5069 ms 3.5090 ms 3.5117 ms]
       thrpt:  [1.1124 GiB/s 1.1132 GiB/s 1.1139 GiB/s]
transfer/walltime/pacing-false/varying-seeds
       time:   [3.5016 ms 3.5027 ms 3.5041 ms]
       thrpt:  [1.1148 GiB/s 1.1152 GiB/s 1.1156 GiB/s]
Found 12 outliers among 100 measurements (12.00%)
12 (12.00%) high mild
transfer/walltime/pacing-true/same-seed
       time:   [3.9970 ms 3.9996 ms 4.0026 ms]
       thrpt:  [999.36 MiB/s 1000.1 MiB/s 1000.7 MiB/s]
transfer/walltime/pacing-true/varying-seeds
       time:   [3.9137 ms 3.9151 ms 3.9169 ms]
       thrpt:  [1021.2 MiB/s 1021.7 MiB/s 1022.1 MiB/s]
Found 11 outliers among 100 measurements (11.00%)
8 (8.00%) high mild
3 (3.00%) high severe

Instructions per cycle

Criterion reported no significant timing changes.

All benchmarks
Benchmark IPC before IPC after ΔIPC
transfer/walltime/pacing-false/varying-seeds 2.88 2.83 -1.8%
transfer/1-conn/1-100mb-resp (aka. Download)/mtu-1500 3.11 3.07 -1.4%
streams-flow-controlled/walltime/1-streams/each-4194304-bytes 2.97 2.93 -1.3%
transfer/walltime/pacing-true/varying-seeds 2.88 2.85 -1.2%
transfer/1-conn/10_000-parallel-1b-resp (aka. RPS)/mtu-1500 3.20 3.23 +0.9%
transfer/1-conn/1-100mb-req (aka. Upload)/mtu-1500 3.08 3.06 -0.8%
streams/walltime/1000-streams/each-1000-bytes 2.93 2.95 +0.5%
transfer/walltime/pacing-false/same-seed 2.86 2.87 +0.5%
streams-flow-controlled/walltime/10-streams/each-1048576-bytes 3.10 3.08 -0.5%
transfer/walltime/pacing-true/same-seed 2.85 2.86 +0.4%
transfer/1-conn/1-1b-resp (aka. HPS)/mtu-1500 2.25 2.24 -0.3%
streams/walltime/1000-streams/each-1-bytes 3.28 3.27 -0.2%
streams/walltime/1-streams/each-1000-bytes 2.56 2.56 +0.1%
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