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

chore: Remove some unwraps and replace others by expect #2294

Merged
merged 35 commits into from
Feb 2, 2025

Conversation

larseggert
Copy link
Collaborator

@larseggert larseggert commented Dec 19, 2024

In functions that return Result or Option or where it is easy to make them do so w/o too many other code changes.

This lets us enable the clippy unwrap_used check, which is a nice reminder not to be casual with unwrap.

In functions that return `Result`.
Copy link

github-actions bot commented Dec 19, 2024

Failed Interop Tests

QUIC Interop Runner, client vs. server, differences relative to 108fb8d.

neqo-latest as client

neqo-latest as server

All results

Succeeded Interop Tests

QUIC Interop Runner, client vs. server

neqo-latest as client

neqo-latest as server

Unsupported Interop Tests

QUIC Interop Runner, client vs. server

neqo-latest as client

neqo-latest as server

Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 90.15660% with 44 lines in your changes missing coverage. Please review.

Project coverage is 95.26%. Comparing base (63506c5) to head (582f74c).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../features/extended_connect/webtransport_session.rs 53.84% 12 Missing ⚠️
neqo-transport/src/send_stream.rs 84.90% 8 Missing ⚠️
neqo-crypto/src/agent.rs 76.47% 4 Missing ⚠️
neqo-crypto/src/agentio.rs 66.66% 4 Missing ⚠️
neqo-transport/src/connection/mod.rs 89.18% 4 Missing ⚠️
neqo-transport/src/recovery/mod.rs 84.00% 4 Missing ⚠️
neqo-qpack/src/decoder.rs 66.66% 2 Missing ⚠️
neqo-transport/src/path.rs 86.66% 2 Missing ⚠️
neqo-transport/src/tracking.rs 97.05% 2 Missing ⚠️
neqo-http3/src/connection.rs 93.75% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2294      +/-   ##
==========================================
- Coverage   95.31%   95.26%   -0.06%     
==========================================
  Files         114      114              
  Lines       36869    36903      +34     
  Branches    36869    36903      +34     
==========================================
+ Hits        35142    35155      +13     
- Misses       1721     1742      +21     
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@larseggert larseggert changed the title chore: Remove some unwraps chore: Remove some unwraps and replace others by expect Dec 20, 2024
Copy link
Member

@martinthomson martinthomson left a comment

Choose a reason for hiding this comment

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

Lots of improvements here, but there are a few places where some of that could be improved.

(Non-blocking comment as I'm going on leave.)

neqo-crypto/src/agent.rs Outdated Show resolved Hide resolved
neqo-crypto/tests/selfencrypt.rs Outdated Show resolved Hide resolved
neqo-http3/src/client_events.rs Outdated Show resolved Hide resolved
neqo-transport/src/crypto.rs Outdated Show resolved Hide resolved
neqo-transport/src/path.rs Show resolved Hide resolved
neqo-transport/src/path.rs Outdated Show resolved Hide resolved
neqo-transport/src/recovery/mod.rs Outdated Show resolved Hide resolved
neqo-transport/src/tparams.rs Outdated Show resolved Hide resolved
larseggert and others added 6 commits December 27, 2024 11:06
Copy link

github-actions bot commented Jan 7, 2025

Benchmark results

Performance differences relative to 63506c5.

decode 4096 bytes, mask ff: No change in performance detected.
       time:   [11.884 µs 11.921 µs 11.965 µs]
       change: [-0.7024% -0.1887% +0.2996%] (p = 0.47 > 0.05)

Found 20 outliers among 100 measurements (20.00%)
2 (2.00%) low severe
4 (4.00%) low mild
3 (3.00%) high mild
11 (11.00%) high severe

decode 1048576 bytes, mask ff: No change in performance detected.
       time:   [3.0763 ms 3.0846 ms 3.0947 ms]
       change: [-0.7042% -0.1744% +0.3365%] (p = 0.52 > 0.05)

Found 8 outliers among 100 measurements (8.00%)
8 (8.00%) high severe

decode 4096 bytes, mask 7f: No change in performance detected.
       time:   [19.827 µs 19.870 µs 19.920 µs]
       change: [-0.1739% +0.2184% +0.6397%] (p = 0.33 > 0.05)

Found 17 outliers among 100 measurements (17.00%)
1 (1.00%) low severe
1 (1.00%) low mild
1 (1.00%) high mild
14 (14.00%) high severe

decode 1048576 bytes, mask 7f: No change in performance detected.
       time:   [5.1632 ms 5.1762 ms 5.1910 ms]
       change: [-0.2811% +0.0961% +0.4454%] (p = 0.62 > 0.05)

Found 15 outliers among 100 measurements (15.00%)
1 (1.00%) low mild
14 (14.00%) high severe

decode 4096 bytes, mask 3f: No change in performance detected.
       time:   [6.8976 µs 6.9235 µs 6.9562 µs]
       change: [-0.8404% +2.1916% +7.7110%] (p = 0.57 > 0.05)

Found 20 outliers among 100 measurements (20.00%)
4 (4.00%) low severe
3 (3.00%) low mild
3 (3.00%) high mild
10 (10.00%) high severe

decode 1048576 bytes, mask 3f: Change within noise threshold.
       time:   [1.7654 ms 1.7737 ms 1.7822 ms]
       change: [+0.2118% +0.6898% +1.2414%] (p = 0.01 < 0.05)

Found 15 outliers among 100 measurements (15.00%)
3 (3.00%) high mild
12 (12.00%) high severe

coalesce_acked_from_zero 1+1 entries: No change in performance detected.
       time:   [92.984 ns 93.363 ns 93.758 ns]
       change: [-0.3746% +0.2756% +0.8701%] (p = 0.39 > 0.05)

Found 10 outliers among 100 measurements (10.00%)
6 (6.00%) high mild
4 (4.00%) high severe

coalesce_acked_from_zero 3+1 entries: No change in performance detected.
       time:   [110.21 ns 110.46 ns 110.73 ns]
       change: [-0.6557% -0.2186% +0.2084%] (p = 0.33 > 0.05)

Found 11 outliers among 100 measurements (11.00%)
3 (3.00%) low mild
2 (2.00%) high mild
6 (6.00%) high severe

coalesce_acked_from_zero 10+1 entries: No change in performance detected.
       time:   [109.94 ns 110.45 ns 111.02 ns]
       change: [-0.2525% +0.3531% +1.2091%] (p = 0.38 > 0.05)

Found 12 outliers among 100 measurements (12.00%)
4 (4.00%) low mild
8 (8.00%) high severe

coalesce_acked_from_zero 1000+1 entries: No change in performance detected.
       time:   [92.486 ns 93.908 ns 97.084 ns]
       change: [-1.4611% +8.1888% +26.944%] (p = 0.59 > 0.05)

Found 10 outliers among 100 measurements (10.00%)
4 (4.00%) high mild
6 (6.00%) high severe

RxStreamOrderer::inbound_frame(): No change in performance detected.
       time:   [111.68 ms 111.73 ms 111.78 ms]
       change: [-0.1164% +0.0947% +0.2311%] (p = 0.37 > 0.05)

Found 17 outliers among 100 measurements (17.00%)
3 (3.00%) low severe
5 (5.00%) low mild
9 (9.00%) high mild

SentPackets::take_ranges: No change in performance detected.
       time:   [5.1002 µs 5.1784 µs 5.2501 µs]
       change: [-16.682% -4.5942% +3.9366%] (p = 0.64 > 0.05)

Found 3 outliers among 100 measurements (3.00%)
3 (3.00%) high mild

transfer/pacing-false/varying-seeds: Change within noise threshold.
       time:   [40.582 ms 40.669 ms 40.758 ms]
       change: [-1.2698% -0.9854% -0.6889%] (p = 0.00 < 0.05)

Found 2 outliers among 100 measurements (2.00%)
2 (2.00%) high mild

transfer/pacing-true/varying-seeds: Change within noise threshold.
       time:   [40.636 ms 40.720 ms 40.811 ms]
       change: [-1.3641% -1.1002% -0.8409%] (p = 0.00 < 0.05)

Found 2 outliers among 100 measurements (2.00%)
1 (1.00%) low mild
1 (1.00%) high severe

transfer/pacing-false/same-seed: Change within noise threshold.
       time:   [40.539 ms 40.622 ms 40.709 ms]
       change: [-0.6251% -0.3339% -0.0504%] (p = 0.02 < 0.05)

Found 4 outliers among 100 measurements (4.00%)
1 (1.00%) low mild
2 (2.00%) high mild
1 (1.00%) high severe

transfer/pacing-true/same-seed: Change within noise threshold.
       time:   [40.924 ms 41.000 ms 41.077 ms]
       change: [-0.8241% -0.5735% -0.3043%] (p = 0.00 < 0.05)

Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high severe

1-conn/1-100mb-resp/mtu-1504 (aka. Download)/client: No change in performance detected.
       time:   [878.89 ms 888.28 ms 898.06 ms]
       thrpt:  [111.35 MiB/s 112.58 MiB/s 113.78 MiB/s]
change:
       time:   [-0.2008% +1.4413% +3.1391%] (p = 0.09 > 0.05)
       thrpt:  [-3.0436% -1.4208% +0.2012%]

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

1-conn/10_000-parallel-1b-resp/mtu-1504 (aka. RPS)/client: No change in performance detected.
       time:   [312.01 ms 314.07 ms 316.21 ms]
       thrpt:  [31.625 Kelem/s 31.840 Kelem/s 32.050 Kelem/s]
change:
       time:   [-1.8784% -0.9080% +0.0360%] (p = 0.07 > 0.05)
       thrpt:  [-0.0360% +0.9163% +1.9144%]

Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild

1-conn/1-1b-resp/mtu-1504 (aka. HPS)/client: 💔 Performance has regressed.
       time:   [34.854 ms 35.041 ms 35.253 ms]
       thrpt:  [28.366  elem/s 28.538  elem/s 28.691  elem/s]
change:
       time:   [+1.0493% +1.7603% +2.5979%] (p = 0.00 < 0.05)
       thrpt:  [-2.5321% -1.7298% -1.0384%]

Found 6 outliers among 100 measurements (6.00%)
1 (1.00%) low mild
5 (5.00%) high severe

1-conn/1-100mb-resp/mtu-1504 (aka. Upload)/client: No change in performance detected.
       time:   [1.6065 s 1.6229 s 1.6397 s]
       thrpt:  [60.988 MiB/s 61.617 MiB/s 62.246 MiB/s]
change:
       time:   [-2.6094% -1.2772% +0.1382%] (p = 0.08 > 0.05)
       thrpt:  [-0.1380% +1.2937% +2.6793%]

Client/server transfer results

Transfer of 33554432 bytes over loopback.

Client Server CC Pacing MTU Mean [ms] Min [ms] Max [ms]
gquiche gquiche 1504 540.6 ± 53.8 502.1 664.7
neqo gquiche reno on 1504 743.9 ± 16.2 721.3 778.0
neqo gquiche reno 1504 747.0 ± 15.5 712.2 770.1
neqo gquiche cubic on 1504 747.5 ± 11.0 722.9 759.9
neqo gquiche cubic 1504 754.3 ± 75.4 694.4 957.6
msquic msquic 1504 145.4 ± 82.9 92.2 337.2
neqo msquic reno on 1504 277.4 ± 78.6 205.4 427.0
neqo msquic reno 1504 267.7 ± 83.6 209.2 447.2
neqo msquic cubic on 1504 262.1 ± 91.0 198.0 492.4
neqo msquic cubic 1504 215.7 ± 14.5 196.5 239.3
gquiche neqo reno on 1504 698.6 ± 148.4 541.9 1023.1
gquiche neqo reno 1504 657.8 ± 80.2 541.8 785.1
gquiche neqo cubic on 1504 658.9 ± 76.4 553.0 783.6
gquiche neqo cubic 1504 669.2 ± 67.8 553.6 773.9
msquic neqo reno on 1504 451.4 ± 8.9 434.9 460.5
msquic neqo reno 1504 487.3 ± 86.2 444.5 731.2
msquic neqo cubic on 1504 455.3 ± 10.0 442.8 467.2
msquic neqo cubic 1504 472.9 ± 4.7 464.2 478.8
neqo neqo reno on 1504 470.8 ± 59.2 427.5 600.1
neqo neqo reno 1504 426.2 ± 14.7 406.2 454.9
neqo neqo cubic on 1504 463.7 ± 9.7 453.8 484.3
neqo neqo cubic 1504 437.9 ± 11.2 424.6 459.1

⬇️ Download logs

@mxinden
Copy link
Collaborator

mxinden commented Jan 13, 2025

@larseggert let me know once you want another review.

@larseggert
Copy link
Collaborator Author

@mxinden when you have a minute, please re-review? (Not urgent.)

neqo-crypto/src/agent.rs Outdated Show resolved Hide resolved
neqo-crypto/src/agent.rs Show resolved Hide resolved
neqo-http3/tests/webtransport.rs Outdated Show resolved Hide resolved
neqo-transport/src/connection/mod.rs Outdated Show resolved Hide resolved
neqo-transport/src/connection/mod.rs Outdated Show resolved Hide resolved
neqo-transport/src/connection/mod.rs Show resolved Hide resolved
@larseggert larseggert enabled auto-merge February 2, 2025 12:27
neqo-crypto/src/agent.rs Outdated Show resolved Hide resolved
neqo-transport/src/connection/mod.rs Outdated Show resolved Hide resolved
neqo-transport/src/lib.rs Outdated Show resolved Hide resolved
neqo-transport/src/recovery/mod.rs Outdated Show resolved Hide resolved
neqo-transport/src/send_stream.rs Outdated Show resolved Hide resolved
@larseggert larseggert disabled auto-merge February 2, 2025 18:30
@larseggert larseggert merged commit 6cdbc0c into mozilla:main Feb 2, 2025
61 of 66 checks passed
@larseggert larseggert deleted the chore-unwrap-less branch February 3, 2025 07:07
larseggert added a commit to larseggert/neqo that referenced this pull request Feb 3, 2025
larseggert added a commit that referenced this pull request Feb 4, 2025
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.

3 participants