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

Reduce memory allocations for SDP marshal #596

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

Conversation

Hartigan
Copy link

Hi

I noticed a large number of memory allocations during marshal of SessionDescription. And I wanna propose implementation of fmt::Display for SessionDescription struct and some fixes fmt::Display implementations for sub types across sdp crate. Also, implementation of fmt::Display will allow to write SessionDescription into preallocated strings:
let mut out = String::with_capacity(1024); write!(out, "{sdp}");

Performance improvement according existed benchmark:
Source SDP/Marshal time: [11.610 µs 11.621 µs 11.633 µs]
New SDP/Marshal time: [4.3594 µs 4.3840 µs 4.4143 µs]

@Hartigan
Copy link
Author

@rainliu I hope this message finds you well. Would you be able to take a moment to review this PR? Or maybe you may suggest who can take care about this PR?

Copy link

codecov bot commented Jul 19, 2024

Codecov Report

Attention: Patch coverage is 57.74648% with 30 lines in your changes missing coverage. Please review.

Project coverage is 61.31%. Comparing base (4bb9614) to head (faa999a).

Files Patch % Lines
sdp/src/description/session.rs 45.94% 0 Missing and 20 partials ⚠️
sdp/src/lexer/mod.rs 70.58% 0 Missing and 5 partials ⚠️
sdp/src/description/media.rs 76.92% 0 Missing and 3 partials ⚠️
sdp/src/description/common.rs 50.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #596      +/-   ##
==========================================
- Coverage   61.35%   61.31%   -0.05%     
==========================================
  Files         532      532              
  Lines       49715    49724       +9     
  Branches    12601    12660      +59     
==========================================
- Hits        30504    30487      -17     
+ Misses       9868     9865       -3     
- Partials     9343     9372      +29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

None yet

1 participant