refactor: Introduce explicit TransmitBuf::first_datagram#352
refactor: Introduce explicit TransmitBuf::first_datagram#352
Conversation
This make the construction of the TransmitBuf a little less weird, but still a bit weird.
Having to initialise an TransmitBuf with the MTU makes no sense in the multipath world. Because the MTU may change depending on which path the buffer is populated for. By passing in the MTU when creating the first datagram, this becomes a lot clearer. Additionally it makes starting datagrams for MTU probes or off-path packets more straightforward. Finally it makes it obvious where the MTU size otherwise sneaks into.
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/quinn/pr/352/docs/iroh_quinn/ Last updated: 2026-01-21T11:05:02Z |
Codecov Report❌ Patch coverage is Additional details and impacted files☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Performance Comparison Report
|
| Scenario | iroh-quinn | upstream | Delta | CPU (avg/max) |
|---|---|---|---|---|
| large-single | N/A | 7508.4 Mbps | N/A | N/A |
| medium-concurrent | N/A | 7061.6 Mbps | N/A | N/A |
| medium-single | N/A | 3967.9 Mbps | N/A | N/A |
| small-concurrent | N/A | 4968.7 Mbps | N/A | N/A |
| small-single | N/A | 4201.5 Mbps | N/A | N/A |
Netsim Benchmarks (network simulation)
| Condition | iroh-quinn | upstream | Delta |
|---|---|---|---|
| ideal | 828.1 Mbps | 3577.4 Mbps | -76.9% |
| lan | 592.1 Mbps | 796.4 Mbps | -25.7% |
| lossy | 55.9 Mbps | 69.8 Mbps | -20.0% |
| wan | 83.8 Mbps | 83.8 Mbps | ~0% |
Summary
iroh-quinn is 65.5% slower on average
3bddedaca9a582d7ea047f4ec7ac4f51384973e1 - artifacts
Raw Benchmarks (localhost)
| Scenario | iroh-quinn | upstream | Delta | CPU (avg/max) |
|---|---|---|---|---|
| large-single | 5408.5 Mbps | 7931.3 Mbps | -31.8% | 93.7% / 98.2% |
| medium-concurrent | 5396.9 Mbps | 7103.9 Mbps | -24.0% | 93.6% / 99.3% |
| medium-single | 3795.3 Mbps | 3941.4 Mbps | -3.7% | 85.5% / 95.4% |
| small-concurrent | 3739.1 Mbps | 5038.6 Mbps | -25.8% | 98.7% / 127.0% |
| small-single | 3349.3 Mbps | 4349.2 Mbps | -23.0% | 86.8% / 96.1% |
Netsim Benchmarks (network simulation)
| Condition | iroh-quinn | upstream | Delta |
|---|---|---|---|
| ideal | 2845.1 Mbps | 3827.7 Mbps | -25.7% |
| lan | 768.5 Mbps | 796.5 Mbps | -3.5% |
| lossy | 69.8 Mbps | 55.9 Mbps | +25.0% |
| wan | 83.8 Mbps | 83.8 Mbps | ~0% |
Summary
iroh-quinn is 23.2% slower on average
Sorry for the drive-by, but reading this, I can't help myself but think that the |
|
I think this is no longer needed, should this be closed? |
|
You don't like this API? I think it is still nice:
Of course the code needs a serious clean up, because of the other changes the diff is pretty useless right now. There are many more improvements to TransmitBuf to make. None of them that urgent but still nice to have. E.g. I'd like to try add back an explicit DatagramBuffer that forbids writing more data into the datagram then allowed. If that works I'd like to try out if it would be possible to automatically "close" the first datagram by dropping that thing or something. Or figure out something to no longer need this manual "clip first datagram/set segment size" call. |
Description
Having to initialise an TransmitBuf with the MTU makes no sense in the multipath world. Because the MTU may change depending on which path the buffer is populated for.
By passing in the MTU when creating the first datagram, this becomes a lot clearer. Additionally it makes starting datagrams for MTU probes or off-path packets more straightforward.
Finally it makes it obvious where the MTU size otherwise sneaks into.
Breaking Changes
n/a
Notes & open questions
poll_transmit is an endless source of possible refactorings. This only targets one specific aspect.