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

Mark BytesMut::extend_from_slice as inline (#1) #595

Merged
merged 1 commit into from
Feb 4, 2023

Conversation

samanpa
Copy link
Contributor

@samanpa samanpa commented Feb 4, 2023

  • Mark BytesMut::extend_from_slice as inline

This function can be hot in applications that do a lot of encoding. Ideally would do the same for <BytesMut as BufMut>::put_slice and <BytesMut as BufMut::put_u8.

$ hyperfine ./target/release/benchber ./target/release/benchber.orig 
Benchmark 1: ./target/release/benchber
  Time (mean ± σ):      1.179 s ±  0.067 s    [User: 0.937 s, System: 0.226 s]
  Range (min … max):    1.055 s …  1.257 s    10 runs
 
Benchmark 2: ./target/release/benchber.orig
  Time (mean ± σ):      1.935 s ±  0.101 s    [User: 1.686 s, System: 0.233 s]
  Range (min … max):    1.795 s …  2.159 s    10 runs
 
Summary
  './target/release/benchber' ran
    1.64 ± 0.13 times faster than './target/release/benchber.orig'

* Mark BytesMut::extend_from_slice as inline

This function can be hot in applications that do a lot of encoding. Ideally would do the same for `<BytesMut as BufMut>::put_slice` and `<BytesMut as BufMut::put_u8`.
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Thanks.

@Darksonn Darksonn merged commit 74b04c7 into tokio-rs:master Feb 4, 2023
@samanpa samanpa mentioned this pull request Sep 6, 2023
@Darksonn Darksonn mentioned this pull request Sep 6, 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