Skip to content

[SCTP] improve payload queue push performance #365

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

Merged
merged 9 commits into from
Jan 2, 2023

Conversation

KillingSpark
Copy link
Contributor

As discussed in #360 Gathering packets to send is a big chunk of the work the Association::write_loop is doing while in a critical section.

This PR improves the performance of this by making the payload queue more performant to push to.

Previously this did a full mergesort (O(n*log(n))) on all the in-flight TSNs, now it does a binary search (O(log(n)))

@codecov
Copy link

codecov bot commented Dec 14, 2022

Codecov Report

Base: 59.99% // Head: 59.97% // Decreases project coverage by -0.02% ⚠️

Coverage data is based on head (87a8710) compared to base (58b4feb).
Patch coverage: 47.61% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #365      +/-   ##
==========================================
- Coverage   59.99%   59.97%   -0.03%     
==========================================
  Files         504      504              
  Lines       48068    48070       +2     
  Branches    12517    12519       +2     
==========================================
- Hits        28838    28828      -10     
- Misses      10011    10019       +8     
- Partials     9219     9223       +4     
Impacted Files Coverage Δ
sctp/src/queue/payload_queue.rs 76.31% <47.61%> (-9.40%) ⬇️
turn/src/client/transaction.rs 63.39% <0.00%> (-1.31%) ⬇️
util/src/vnet/conn/conn_test.rs 56.19% <0.00%> (-0.83%) ⬇️
ice/src/agent/agent_vnet_test.rs 69.74% <0.00%> (-0.16%) ⬇️
ice/src/agent/agent_gather_test.rs 63.19% <0.00%> (+0.30%) ⬆️
util/src/conn/conn_udp_listener.rs 65.38% <0.00%> (+1.28%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@KillingSpark KillingSpark changed the title [sctp] improve payload queue push performance [SCTP] improve payload queue push performance Dec 14, 2022
Copy link
Contributor

@melekes melekes left a comment

Choose a reason for hiding this comment

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

❤️

self.length.fetch_add(1, Ordering::SeqCst);
self.update_sorted_keys();
Copy link
Contributor

Choose a reason for hiding this comment

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

🤦‍♂️

@KillingSpark
Copy link
Contributor Author

KillingSpark commented Dec 21, 2022

Sorry I must have made a mistake, the tests started failing. I'll fix it soon

Fixed 👍

@melekes melekes merged commit 225cec0 into webrtc-rs:master Jan 2, 2023
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.

2 participants