Skip to content
Snippets Groups Projects
  1. Oct 23, 2019
  2. Oct 16, 2019
    • Sean McArthur's avatar
      Refactor Bytes to use an internal vtable (#298) · 43ac8e54
      Sean McArthur authored
      Bytes is a useful tool for managing multiple slices into the same region
      of memory, and the other things it used to have been removed to reduce
      complexity. The exact strategy for managing the multiple references is
      no longer hard-coded, but instead backing by a customizable vtable.
      
      - Removed ability to mutate the underlying memory from the `Bytes` type.
      - Removed the "inline" (SBO) mechanism in `Bytes`. The reduces a large
        amount of complexity, and improves performance when accessing the
        slice of bytes, since a branch is no longer needed to check if the
        data is inline.
      - Removed `Bytes` knowledge of `BytesMut` (`BytesMut` may grow that
        knowledge back at a future point.)
      Unverified
      43ac8e54
  3. Jul 25, 2019
  4. Jul 03, 2018
  5. Jan 03, 2018
    • Stepan Koltsov's avatar
      Optimize shallow_clone for Bytes::split_{off,to} (#92) · 6a3d20bb
      Stepan Koltsov authored
      If `shallow_clone` is called with `&mut self`, and `Bytes` contains
      `Vec`, then expensive CAS can be avoided, because no other thread
      have references to this `Bytes` object.
      
      Bench `split_off_and_drop` difference:
      
      Before the diff:
      
      ```
      test split_off_and_drop             ... bench:      91,858 ns/iter (+/- 17,401)
      ```
      
      With the diff:
      
      ```
      test split_off_and_drop             ... bench:      81,162 ns/iter (+/- 17,603)
      ```
      6a3d20bb
  6. Jul 01, 2017
    • Stepan Koltsov's avatar
      Optimize Bytes::slice for short slices (#136) · b9ccd2a8
      Stepan Koltsov authored
      Slice operation should return inline when possible
      
      It is cheaper than atomic increment/decrement.
      
      Before this patch:
      
      ```
      test slice_avg_le_inline_from_arc   ... bench:      28,582 ns/iter (+/- 3,880)
      test slice_empty                    ... bench:       8,797 ns/iter (+/- 1,325)
      test slice_large_le_inline_from_arc ... bench:      27,684 ns/iter (+/- 5,920)
      test slice_short_from_arc           ... bench:      27,439 ns/iter (+/- 5,783)
      ```
      
      After this patch:
      
      ```
      test slice_avg_le_inline_from_arc   ... bench:      18,872 ns/iter (+/- 2,937)
      test slice_empty                    ... bench:       9,136 ns/iter (+/- 1,908)
      test slice_large_le_inline_from_arc ... bench:      18,052 ns/iter (+/- 2,981)
      test slice_short_from_arc           ... bench:      18,200 ns/iter (+/- 2,534)
      ```
      b9ccd2a8
  7. Jun 15, 2017
  8. May 22, 2017
    • Stepan Koltsov's avatar
      Optimize Bytes::slice(n, n) (#123) · 3f5890be
      Stepan Koltsov authored
      Return empty `Bytes` object
      
      Bench for `slice_empty` difference is
      
      ```
      55 ns/iter (+/- 1) # before this patch
      17 ns/iter (+/- 5) # with this patch
      ```
      
      Bench for `slice_not_empty` is
      
      ```
      25,058 ns/iter (+/- 1,099) # before this patch
      25,072 ns/iter (+/- 1,593) # with this patch
      ```
      3f5890be
    • Carl Lerche's avatar
      Fix benchmarks · 70ee87ea
      Carl Lerche authored
      70ee87ea
Loading