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: Use strum macros #2440

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

larseggert
Copy link
Collaborator

And remove some boilerplate code.

Fixes #2439

And remove some boilerplate code.

Fixes mozilla#2439
Copy link

codecov bot commented Feb 12, 2025

Codecov Report

Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 95.37%. Comparing base (966ece6) to head (fe9812b).

Files with missing lines Patch % Lines
neqo-crypto/src/auth.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2440      +/-   ##
==========================================
+ Coverage   95.26%   95.37%   +0.10%     
==========================================
  Files         115      115              
  Lines       37198    37099      -99     
  Branches    37198    37099      -99     
==========================================
- Hits        35436    35382      -54     
+ Misses       1756     1711      -45     
  Partials        6        6              

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

Copy link

github-actions bot commented Feb 12, 2025

Failed Interop Tests

QUIC Interop Runner, client vs. server, differences relative to 966ece6.

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

github-actions bot commented Feb 12, 2025

Benchmark results

Performance differences relative to 966ece6.

decode 4096 bytes, mask ff: 💚 Performance has improved.
       time:   [10.871 µs 10.913 µs 10.959 µs]
       change: [-12.543% -12.066% -11.643%] (p = 0.00 < 0.05)

Found 19 outliers among 100 measurements (19.00%)
3 (3.00%) low severe
3 (3.00%) low mild
1 (1.00%) high mild
12 (12.00%) high severe

decode 1048576 bytes, mask ff: 💔 Performance has regressed.
       time:   [3.1271 ms 3.1362 ms 3.1468 ms]
       change: [+9.6136% +10.207% +10.737%] (p = 0.00 < 0.05)

Found 9 outliers among 100 measurements (9.00%)
9 (9.00%) high severe

decode 4096 bytes, mask 7f: 💚 Performance has improved.
       time:   [17.631 µs 17.677 µs 17.727 µs]
       change: [-15.974% -15.671% -15.389%] (p = 0.00 < 0.05)

Found 16 outliers among 100 measurements (16.00%)
3 (3.00%) low severe
3 (3.00%) low mild
1 (1.00%) high mild
9 (9.00%) high severe

decode 1048576 bytes, mask 7f: 💔 Performance has regressed.
       time:   [5.4033 ms 5.4159 ms 5.4291 ms]
       change: [+18.559% +18.997% +19.415%] (p = 0.00 < 0.05)

Found 15 outliers among 100 measurements (15.00%)
15 (15.00%) high severe

decode 4096 bytes, mask 3f: 💚 Performance has improved.
       time:   [6.6196 µs 6.6531 µs 6.6900 µs]
       change: [-21.439% -20.961% -20.534%] (p = 0.00 < 0.05)

Found 9 outliers among 100 measurements (9.00%)
4 (4.00%) low mild
3 (3.00%) high mild
2 (2.00%) high severe

decode 1048576 bytes, mask 3f: 💔 Performance has regressed.
       time:   [1.7652 ms 1.7735 ms 1.7820 ms]
       change: [+10.564% +11.283% +12.007%] (p = 0.00 < 0.05)

Found 11 outliers among 100 measurements (11.00%)
11 (11.00%) high severe

coalesce_acked_from_zero 1+1 entries: No change in performance detected.
       time:   [91.462 ns 91.832 ns 92.196 ns]
       change: [-0.3915% +0.0327% +0.4255%] (p = 0.88 > 0.05)

Found 10 outliers among 100 measurements (10.00%)
8 (8.00%) high mild
2 (2.00%) high severe

coalesce_acked_from_zero 3+1 entries: No change in performance detected.
       time:   [109.76 ns 110.80 ns 112.57 ns]
       change: [-0.4305% +0.1404% +0.9376%] (p = 0.71 > 0.05)

Found 14 outliers among 100 measurements (14.00%)
1 (1.00%) low mild
3 (3.00%) high mild
10 (10.00%) high severe

coalesce_acked_from_zero 10+1 entries: No change in performance detected.
       time:   [109.38 ns 109.81 ns 110.33 ns]
       change: [-0.6040% +0.3574% +1.2906%] (p = 0.51 > 0.05)

Found 16 outliers among 100 measurements (16.00%)
1 (1.00%) low severe
5 (5.00%) low mild
1 (1.00%) high mild
9 (9.00%) high severe

coalesce_acked_from_zero 1000+1 entries: No change in performance detected.
       time:   [93.893 ns 94.025 ns 94.172 ns]
       change: [-0.3277% +0.7775% +1.9241%] (p = 0.18 > 0.05)

Found 12 outliers among 100 measurements (12.00%)
6 (6.00%) high mild
6 (6.00%) high severe

RxStreamOrderer::inbound_frame(): Change within noise threshold.
       time:   [111.63 ms 111.68 ms 111.74 ms]
       change: [-0.5751% -0.5101% -0.4479%] (p = 0.00 < 0.05)

Found 11 outliers among 100 measurements (11.00%)
7 (7.00%) low mild
4 (4.00%) high mild

SentPackets::take_ranges: No change in performance detected.
       time:   [5.3256 µs 5.4941 µs 5.6718 µs]
       change: [-3.1503% +0.3448% +3.6158%] (p = 0.85 > 0.05)

Found 8 outliers among 100 measurements (8.00%)
6 (6.00%) high mild
2 (2.00%) high severe

transfer/pacing-false/varying-seeds: No change in performance detected.
       time:   [34.213 ms 34.277 ms 34.347 ms]
       change: [-0.3882% -0.1404% +0.1236%] (p = 0.29 > 0.05)

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

transfer/pacing-true/varying-seeds: Change within noise threshold.
       time:   [34.235 ms 34.303 ms 34.375 ms]
       change: [-0.8519% -0.6059% -0.3590%] (p = 0.00 < 0.05)

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

transfer/pacing-false/same-seed: Change within noise threshold.
       time:   [34.005 ms 34.063 ms 34.123 ms]
       change: [-1.3367% -1.0939% -0.8652%] (p = 0.00 < 0.05)

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

transfer/pacing-true/same-seed: No change in performance detected.
       time:   [34.437 ms 34.482 ms 34.529 ms]
       change: [-0.0224% +0.2201% +0.4457%] (p = 0.07 > 0.05)

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

1-conn/1-100mb-resp/mtu-1504 (aka. Download)/client: 💔 Performance has regressed.
       time:   [862.61 ms 873.89 ms 885.47 ms]
       thrpt:  [112.93 MiB/s 114.43 MiB/s 115.93 MiB/s]
change:
       time:   [+3.0710% +4.9809% +6.9210%] (p = 0.00 < 0.05)
       thrpt:  [-6.4730% -4.7446% -2.9795%]
1-conn/10_000-parallel-1b-resp/mtu-1504 (aka. RPS)/client: No change in performance detected.
       time:   [317.64 ms 320.98 ms 324.30 ms]
       thrpt:  [30.835 Kelem/s 31.154 Kelem/s 31.483 Kelem/s]
change:
       time:   [-2.0190% -0.5610% +0.8917%] (p = 0.46 > 0.05)
       thrpt:  [-0.8838% +0.5641% +2.0606%]
1-conn/1-1b-resp/mtu-1504 (aka. HPS)/client: No change in performance detected.
       time:   [25.431 ms 25.598 ms 25.773 ms]
       thrpt:  [38.800  elem/s 39.065  elem/s 39.322  elem/s]
change:
       time:   [-0.8695% +0.0099% +0.9625%] (p = 0.98 > 0.05)
       thrpt:  [-0.9534% -0.0099% +0.8771%]

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

1-conn/1-100mb-resp/mtu-1504 (aka. Upload)/client: No change in performance detected.
       time:   [1.8686 s 1.8878 s 1.9071 s]
       thrpt:  [52.435 MiB/s 52.973 MiB/s 53.517 MiB/s]
change:
       time:   [-0.2142% +1.2999% +2.8261%] (p = 0.09 > 0.05)
       thrpt:  [-2.7484% -1.2832% +0.2147%]

Client/server transfer results

Performance differences relative to 966ece6.

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

Client Server CC Pacing Mean ± σ Min Max Δ main Δ main
neqo neqo reno on 530.8 ± 78.8 436.0 810.5 -13.8 -0.6%
neqo neqo reno 548.8 ± 154.7 445.9 1153.5 15.4 0.7%
neqo neqo cubic on 551.0 ± 47.8 479.1 717.9 10.0 0.5%
neqo neqo cubic 539.0 ± 49.3 459.1 720.6 2.4 0.1%
google neqo reno on 883.8 ± 97.5 647.0 1023.0 6.9 0.2%
google neqo reno 884.6 ± 105.7 632.2 1135.1 4.1 0.1%
google neqo cubic on 877.3 ± 96.8 645.3 1030.4 -0.9 -0.0%
google neqo cubic 878.5 ± 98.6 648.7 1029.1 3.6 0.1%
google google 542.5 ± 32.3 520.5 699.3 -5.7 -0.3%
neqo msquic reno on 231.4 ± 47.0 203.7 406.2 5.5 0.6%
neqo msquic reno 228.2 ± 32.5 200.2 369.5 7.3 0.8%
neqo msquic cubic on 229.2 ± 38.9 199.8 376.2 0.7 0.1%
neqo msquic cubic 234.6 ± 55.4 202.9 447.0 14.1 1.5%
msquic msquic 118.2 ± 38.5 97.8 314.7 0.9 0.2%

⬇️ Download logs

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.

Yeah, this is better than I had anticipated. The from_repr() method is a bit weird, but you managed to hide it neatly.

use crate::err::{mozpkix, sec, ssl, PRErrorCode};

/// The outcome of authentication.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, FromRepr)]
#[repr(i32)]
Copy link
Member

Choose a reason for hiding this comment

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

Does this work?

Suggested change
#[repr(i32)]
#[repr(PRErrorCode)]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unfortunately not, I had tried that:

error[E0552]: unrecognized representation hint
  --> neqo-crypto/src/auth.rs:13:8
   |
13 | #[repr(PRErrorCode)]
   |        ^^^^^^^^^^^
   |
   = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`

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.

Use strum
2 participants