perf(quic): optimization#588
Conversation
There was a problem hiding this comment.
Pull request overview
This PR optimizes the QUIC implementation by refactoring buffer management and tuning performance parameters. The changes aim to improve efficiency through better API design and reduced overhead.
- Modified
read*methods to use&mut impl IoBufMutinstead ofimpl bytes::BufMutfor more efficient buffer handling - Replaced
BTreeMapwithVecfor chunk storage to eliminate unnecessary sorting overhead - Reduced GSO segments from 64 to 32 for improved network performance
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| compio-quic/src/socket.rs | Reduces max GSO segments from 64 to 32 for performance tuning |
| compio-quic/src/recv_stream.rs | Refactors read operations to use IoBufMut instead of BufMut, replaces BTreeMap with Vec for chunk storage, and updates buffer handling logic |
| compio-quic/benches/quic.rs | Improves benchmark accuracy by moving timer start after connection establishment, adds proper connection cleanup, and clarifies server naming |
Comments suppressed due to low confidence (1)
compio-quic/src/recv_stream.rs:530
- Double
advance_tocall detected. Thereadmethod already callsunsafe { buf.advance_to(n) }at line 259 inpoll_read, but then thisAsyncReadimplementation callsadvance_toagain at line 529. This will advance the buffer position twice, leading to incorrect buffer state and potentially skipping data or causing out-of-bounds access.
let n = n.unwrap_or_default();
unsafe { buf.advance_to(n) }
n
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4a06e23 to
59e0460
Compare
AsakuraMizu
left a comment
There was a problem hiding this comment.
The use of IoBufMut is a bit odd, because I think it's more like a compio internal thing (I'm not sure if I'm right), and it's certainly not as general as BufMut (fewer impl).
Also, there are other APIs using stuffs from the bytes crate (read_chunks/write_chunks/write_all_chunks(&mut [Bytes])).
Finally, it introduces some unnecessary unsafe, which I don't like much.
|
The reason is simple. |
|
Well, actually I think it's OK to use |
I was just about to say that; I've already forgotten why I didn't design it that way back then. |
1b8fd65 to
7a7af72
Compare
|
Illumos CI failed unexceptedly. Might because of the action itself. |
They suddenly changed a lot of things: vmactions/omnios-vm@v1.1.5...v1.1.6 |
|
The cause of the performance degradation has finally been found: quinn-rs/quinn#2185 |
|
I think I'll purpose this IO design:
|
|
Oh, maybe another |
c47d2c6 to
0e0d497
Compare
|
I removed the API changes. Let's just solve the optimization problem. |
Closes #587
read*methods to use&mut impl IoBufMutinstead ofimpl bytes::BufMut.Vecinstead ofBTreeMapbecause we don't need to sort the chunks.