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

Defragment incoming stream chunks (fixes #431) #598

Merged
merged 1 commit into from
Jan 17, 2020
Merged

Defragment incoming stream chunks (fixes #431) #598

merged 1 commit into from
Jan 17, 2020

Conversation

djc
Copy link
Collaborator

@djc djc commented Jan 14, 2020

Here's an attempt at solving that old memory fragmentation issue. The 32 threshold is just a simple heuristic: in the worst case we accept 32 1-byte chunks from 32 different datagrams, 32k of unnecessary allocations, but hopefully most applications would not get up to 32 chunks in the buffer so that they would not trigger the (relatively slow) defragmentation code.

Let me know what you think!

@codecov
Copy link

codecov bot commented Jan 14, 2020

Codecov Report

Merging #598 into master will decrease coverage by 2.67%.
The diff coverage is 96.29%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #598      +/-   ##
==========================================
- Coverage   69.14%   66.46%   -2.68%     
==========================================
  Files          64       64              
  Lines       11120    11637     +517     
==========================================
+ Hits         7689     7735      +46     
- Misses       3431     3902     +471
Impacted Files Coverage Δ
quinn-proto/src/assembler.rs 97.05% <96.29%> (-0.19%) ⬇️
quinn-h3/src/qpack/prefix_string/encode.rs 18.6% <0%> (-70.29%) ⬇️
quinn-h3/src/qpack/prefix_string/decode.rs 12.72% <0%> (-67.28%) ⬇️
quinn-h3/src/qpack/vas.rs 97.22% <0%> (-1.84%) ⬇️
quinn-h3/src/qpack/prefix_int.rs 98.46% <0%> (+0.04%) ⬆️
quinn-proto/src/crypto/ring.rs 93.29% <0%> (+0.07%) ⬆️
quinn-h3/src/qpack/encoder.rs 92.91% <0%> (+0.1%) ⬆️
quinn-proto/src/connection.rs 78.6% <0%> (+0.38%) ⬆️
quinn-h3/src/proto/frame.rs 79.03% <0%> (+0.81%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8f31992...2d7b6dc. Read the comment docs.

Copy link
Collaborator

@Ralith Ralith left a comment

Choose a reason for hiding this comment

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

This is a beautiful solution, great work! I was imagining much more complex approaches.

quinn-proto/src/assembler.rs Show resolved Hide resolved
quinn-proto/src/assembler.rs Show resolved Hide resolved
@djc
Copy link
Collaborator Author

djc commented Jan 14, 2020

This is a beautiful solution, great work! I was imagining much more complex approaches.

Me too! I was quite happy that I came up with this little thing last night, although I lost some sleep over it. 😄

Copy link
Collaborator

@Ralith Ralith left a comment

Choose a reason for hiding this comment

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

Great stuff!

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.

None yet

2 participants