-
Notifications
You must be signed in to change notification settings - Fork 4
fix(quinn-proto): prevent O(N^2) behaviour when sending a lot of small values in SendBuffer #247
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
base: main
Are you sure you want to change the base?
Conversation
In preparation to adding a BytesMut at the end
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #247 +/- ##
==========================================
- Coverage 76.66% 76.60% -0.06%
==========================================
Files 83 83
Lines 23347 23432 +85
==========================================
+ Hits 17898 17950 +52
- Misses 5449 5482 +33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/quinn/pr/247/docs/iroh_quinn/ Last updated: 2025-12-22T14:09:07Z |
bfe3daa to
0234c4a
Compare
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { |
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.
I was wondering if we could have some proptests? 😅 they have been very good at making sure things have less bugs
|
Removed myself from review, would love to see this merged but I don't think I have much helpful impact on this. Feel free to re-request if needed. (also, can this be merged yet? 😀 ) |
7d9c0e4 to
3f401b8
Compare
Description
Replace SendBuffer::get with get_into that scans the entire buffer and copies the relevant range to a &mut impl BufMut.
This turns the O(N*K) when the buffer consists of many tiny slices to O(N).
Also does some refactoring to prepare for a mutable buffer at the end, and renames some variables.
Breaking Changes
None
Notes & open questions
Q: Should we keep the "test" for O(NK) behaviour?
Q: is it ok to panic when misused? Before this would have led to an endless loop.