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

perf, ringbuf: add ReadBuffer mehods #663

Merged
merged 3 commits into from May 10, 2022
Merged

Commits on May 10, 2022

  1. perf: add Reader.ReadInto

    Allow reading from a Reader without allocations, once a steady state
    has been reached.
    
        name          time/op
        Reader-4      8.84µs ± 3%
        ReadInto-4    8.83µs ± 4%
    
        name          alloc/op
        Reader-4        384B ± 0%
        ReadInto-4      288B ± 0%
    
        name          allocs/op
        Reader-4        2.00 ± 0%
        ReadInto-4      1.00 ± 0%
    lmb committed May 10, 2022
    Copy the full SHA
    454f0e7 View commit details
    Browse the repository at this point in the history
  2. ringbuf: fix BenchmarkReader

    Move calls to ResetTimer and ReportAllocs and avoid allocating a
    temporary buffer.
    lmb committed May 10, 2022
    Copy the full SHA
    c80c08d View commit details
    Browse the repository at this point in the history
  3. ringbuf: add ReadInto method

    Add a ReadInto method to ringbuf.Reader, analogous to perf.Reader.
    
        name                                   time/op
        Reader/normal_epoll_with_timeout_-1-4  8.87µs ± 1%
        ReadInto-4                             8.90µs ± 3%
    
        name                                   alloc/op
        Reader/normal_epoll_with_timeout_-1-4    368B ± 0%
        ReadInto-4                               288B ± 0%
    
        name                                   allocs/op
        Reader/normal_epoll_with_timeout_-1-4    2.00 ± 0%
        ReadInto-4                               1.00 ± 0%
    lmb committed May 10, 2022
    Copy the full SHA
    3554ba1 View commit details
    Browse the repository at this point in the history