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 allocations in pem::encode #50

Merged
merged 1 commit into from
Jul 26, 2023
Merged

Conversation

alex
Copy link
Contributor

@alex alex commented Jul 26, 2023

Shows ~45% performance improvement

Before:

pem::encode             time:   [1.0654 µs 1.0674 µs 1.0696 µs]                         
Found 2 outliers among 100 measurements (2.00%)
  1 (1.00%) high mild
  1 (1.00%) high severe

pem::encode_many        time:   [2.2387 µs 2.2488 µs 2.2585 µs]                              

After:

pem::encode             time:   [597.59 ns 603.58 ns 609.70 ns]                         
                        change: [-44.590% -44.219% -43.829%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 19 outliers among 100 measurements (19.00%)
  2 (2.00%) high mild
  17 (17.00%) high severe

pem::encode_many        time:   [1.2678 µs 1.2723 µs 1.2771 µs]                              
                        change: [-43.377% -43.152% -42.931%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  6 (6.00%) high mild
  1 (1.00%) high severe

Shows ~45% performance improvement
Copy link
Owner

@jcreekmore jcreekmore left a comment

Choose a reason for hiding this comment

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

Huh. I have literally never used core::fmt::Write explicitly before. I guess you learn something new every day. It makes complete sense why this would reduce allocations by roughly half, though.

@jcreekmore jcreekmore merged commit d990881 into jcreekmore:master Jul 26, 2023
1 check passed
@alex alex deleted the reduce-alloc branch July 26, 2023 21:16
@jcreekmore
Copy link
Owner

Released 3.0.1

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

2 participants