-
Notifications
You must be signed in to change notification settings - Fork 127
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
perf: don't allocate in UDP send & recv path #2093
Changes from 83 commits
5d847ee
b334e84
2db53a2
9fef795
995c499
1c653de
c05bc64
08eba9d
ae112c8
828da75
dfa33b2
763b391
8dee7b3
5576875
b9457bb
94d1a68
e2d1452
2e2a76e
1947d33
8ea56b2
3df6660
52dfa91
8699209
1b9259c
07c2b3b
14a9643
f0855e1
936ea2b
19a82cd
55adc20
1cee426
e9dd74d
99a323e
147df66
3928c62
34d904e
7f6ca94
bd325fe
28f9b0a
7cae54f
b03f8d4
2003c84
38179ef
fbccdf2
24e0cbd
6deaef8
5244fc1
15eb2f8
ffc3708
e5bc0e2
eb09a9a
5ab4e01
08c49e6
2b0103a
c254319
1bd20da
8137e73
166ae86
93c1fa5
3a134d6
61565b4
f65dde5
c6f58dc
55e650f
92c48de
a4d1ef2
75c1de2
1ce5455
91fbc6b
f675eb9
d0916a8
bf807b8
760aade
589b8b4
30593e3
5ad1f35
136a8c4
b070374
55219b8
e247d47
6b30ee5
f57d1b2
f866a2a
24ba2d4
fe6ed10
6aa438d
364f5bd
f5b2d7f
bbb93cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
diff --git a/neqo-http3/src/server.rs b/neqo-http3/src/server.rs | ||
index 9b73f2c7..d6cd39a2 100644 | ||
--- a/neqo-http3/src/server.rs | ||
+++ b/neqo-http3/src/server.rs | ||
@@ -120,12 +120,7 @@ impl Http3Server { | ||
out: &'a mut Vec<u8>, | ||
) -> Output<&'a [u8]> { | ||
qtrace!([self], "Process."); | ||
- let mut output = self.server.process_into_buffer( | ||
- dgram, | ||
- now, | ||
- // See .github/workflows/polonius.yml. | ||
- unsafe { &mut *std::ptr::from_mut(out) }, | ||
- ); | ||
+ let mut output = self.server.process_into_buffer(dgram, now, out); | ||
|
||
self.process_http3(now); | ||
|
||
diff --git a/neqo-transport/src/server.rs b/neqo-transport/src/server.rs | ||
index 2446f8d3..25ceb2b0 100644 | ||
--- a/neqo-transport/src/server.rs | ||
+++ b/neqo-transport/src/server.rs | ||
@@ -445,12 +445,7 @@ impl Server { | ||
let mut callback = None; | ||
|
||
for connection in &mut self.connections { | ||
- match connection.borrow_mut().process_into_buffer( | ||
- None, | ||
- now, | ||
- // See .github/workflows/polonius.yml. | ||
- unsafe { &mut *std::ptr::from_mut(out) }, | ||
- ) { | ||
+ match connection.borrow_mut().process_into_buffer(None, now, out) { | ||
Output::None => {} | ||
d @ Output::Datagram(_) => return d, | ||
Output::Callback(next) => match callback { | ||
@@ -491,12 +486,7 @@ impl Server { | ||
|
||
#[allow(clippy::option_if_let_else)] | ||
let output = if let Some(dgram) = dgram { | ||
- self.process_input( | ||
- dgram, | ||
- now, | ||
- // See .github/workflows/polonius.yml. | ||
- unsafe { &mut *std::ptr::from_mut(out) }, | ||
- ) | ||
+ self.process_input(dgram, now, out) | ||
} else { | ||
Output::None | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Rustc by default uses the NLL borrow-checker. There are multiple cases where | ||
# NLL is too restrictive. An upcoming improvement to Rust's borrow-checker, | ||
# adressing these shortcomings, is Polonius. It ships with Nightly behind a | ||
# flag. | ||
# | ||
# This workflow first removes the workarounds necessary to please NLL and then | ||
# runs with Polonius to ensure each workaround only fixes the false-positive of | ||
# NLL and doesn't mask an actually undefined behavior. | ||
Comment on lines
+6
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Somewhat unconventional. Still, I think statically proving |
||
# | ||
# See also: | ||
# - <https://blog.rust-lang.org/inside-rust/2023/10/06/polonius-update.html> | ||
# - <https://github.com/rust-lang/rust/issues/54663> | ||
|
||
name: Polonius | ||
on: | ||
push: | ||
branches: ["main"] | ||
paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"] | ||
pull_request: | ||
branches: ["main"] | ||
paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"] | ||
merge_group: | ||
workflow_dispatch: | ||
env: | ||
CARGO_TERM_COLOR: always | ||
RUST_BACKTRACE: 1 | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref_name }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
polonius: | ||
strategy: | ||
fail-fast: false | ||
defaults: | ||
run: | ||
shell: bash | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
- uses: ./.github/actions/rust | ||
with: | ||
version: nightly | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- id: nss-version | ||
run: echo "minimum=$(cat neqo-crypto/min_version.txt)" >> "$GITHUB_OUTPUT" | ||
|
||
- uses: ./.github/actions/nss | ||
with: | ||
minimum-version: ${{ steps.nss-version.outputs.minimum }} | ||
|
||
- name: Apply patch, removing `unsafe` workarounds. | ||
run: git apply .github/workflows/polonius.diff | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't really the best place to keep this diff. Put it in the tree. |
||
|
||
- run: RUSTFLAGS="-Z polonius" cargo +nightly check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See
.github/workflows/polonius.yml
right below.