Inline the buffer construction functions

Otherwise there ends up being a copy of the 40-byte buffer. Noticeable
improvement on `cargo bench` in the small integer cases compared to
parent commit.
This commit is contained in:
David Tolnay 2018-09-08 12:02:36 -07:00
parent 762dedb54c
commit 4b662e7486
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
1 changed files with 2 additions and 0 deletions

View File

@ -47,6 +47,7 @@ pub struct Buffer {
}
impl Default for Buffer {
#[inline]
fn default() -> Buffer {
Buffer::new()
}
@ -55,6 +56,7 @@ impl Default for Buffer {
impl Buffer {
/// This is a cheap operation; you don't need to worry about reusing buffers
/// for efficiency.
#[inline]
pub fn new() -> Buffer {
Buffer { bytes: unsafe { mem::uninitialized() } }
}