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

optimize frameSorter gaps with AVL tree #3471

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

tobyxdd
Copy link
Contributor

@tobyxdd tobyxdd commented Jul 6, 2022

Closes #300

@codecov
Copy link

codecov bot commented Jul 6, 2022

Codecov Report

Merging #3471 (9a64b4f) into master (18d3846) will increase coverage by 0.07%.
Report is 3 commits behind head on master.
The diff coverage is 84.62%.

@@            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     
Files Changed Coverage Δ
internal/utils/streamframe_interval.go 0.00% <0.00%> (ø)
internal/utils/tree/tree.go 89.22% <89.22%> (ø)
frame_sorter.go 100.00% <100.00%> (+2.44%) ⬆️

... and 4 files with indirect coverage changes

@tobyxdd
Copy link
Contributor Author

tobyxdd commented Jul 10, 2022

@marten-seemann do you want to review this too?

@zllovesuki
Copy link
Contributor

Getting merge conflict on the latest master 8c0c481, can you double check this PR?

@bt90
Copy link
Contributor

bt90 commented Aug 27, 2022

@tobyxdd

@tobyxdd
Copy link
Contributor Author

tobyxdd commented Aug 27, 2022

I'm traveling and won't be available this week. Will get back to it right after.

@tobyxdd
Copy link
Contributor Author

tobyxdd commented Sep 10, 2022

@zllovesuki @bt90 conflicts resolved

@otbutz
Copy link

otbutz commented Sep 29, 2022

@marten-seemann

@otbutz
Copy link

otbutz commented Nov 21, 2022

👋

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.
Copy link

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
@tobyxdd
Copy link
Contributor Author

tobyxdd commented Aug 5, 2023

@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.

Copy link
Member

@marten-seemann marten-seemann left a 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 {
Copy link
Member

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?

Comment on lines 1 to 19
/*
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.
*/
Copy link
Member

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.

@tobyxdd
Copy link
Contributor Author

tobyxdd commented Aug 6, 2023

Thanks @marten-seemann . I will attach some real world benchmarks & see what I can do about the frame sorter tests.

@marten-seemann
Copy link
Member

Thank you @tobyxdd! For benchmarks, please use the regular Go benchmarks, not the Ginkgo equivalent.

@marten-seemann
Copy link
Member

@tobyxdd Not urgent, but have you made any progress with this PR?

@tobyxdd
Copy link
Contributor Author

tobyxdd commented Aug 22, 2023

@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

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.

use efficient data structure in StreamFrameSorter
5 participants