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
optimize frameSorter gaps with AVL tree #3471
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3471 +/- ##
==========================================
+ Coverage 82.81% 82.88% +0.07%
==========================================
Files 147 149 +2
Lines 14764 15129 +365
==========================================
+ Hits 12226 12539 +313
- Misses 2036 2081 +45
- Partials 502 509 +7
|
@marten-seemann do you want to review this too? |
Getting merge conflict on the latest master 8c0c481, can you double check this PR? |
I'm traveling and won't be available this week. Will get back to it right after. |
@zllovesuki @bt90 conflicts resolved |
👋 |
internal/utils/tree/tree.go
Outdated
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. |
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.
or substantial portions of the Software
# Conflicts: # frame_sorter.go # frame_sorter_test.go
@marten-seemann Any hope of this being merged? I'm willing to address any obstacles or concerns that prevent this from being considered. I've been using this patch in my project for over a year, and can confirm that the CPU performance improvement it brings (at least in cases of high packet loss) is by a factor of several times. Honestly it'd be a shame to overlook this, especially given the project's recent focus on performance improvements. |
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.
@tobyxdd Sorry I dropped the ball on this.
I'm not opposed to moving this PR forward. I was hesitant because I really don't want to be maintaining a tree implementation, but I've given up hope that there'll be a universally accepted generic data structure package in Go (maybe even in the standard library).
Do you have any benchmarks showing how this performs in production?
I'd also like to have some benchmarks in the frame sorter test file. The most important test case would be the common case (i.e. no frame reordering). Of course, it would also be interesting to have a benchmark that tests slight reordering (maybe on the order of 5%) and heavy reordering. Would you mind adding some benchmark tests, and posting a before / after comparison here?
) | ||
|
||
// ByteInterval is an interval from one ByteCount to the other | ||
type ByteInterval struct { |
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 assume this implementing an interface needed by the tree. Can you add an interface assertion?
internal/utils/tree/tree.go
Outdated
/* | ||
Copyright (c) 2017 Ross Oreto | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ |
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 don't think we need to copy the license here. This is an MIT license, which is compatible with quic-go's license.
Thanks @marten-seemann . I will attach some real world benchmarks & see what I can do about the frame sorter tests. |
Thank you @tobyxdd! For benchmarks, please use the regular Go benchmarks, not the Ginkgo equivalent. |
@tobyxdd Not urgent, but have you made any progress with this PR? |
I was busy working on some other stuff. Should be able to post the results this week |
Closes #300