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(client): prealloc pkg/varlog.(*transmitter).transmitQueue #721

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

ijsong
Copy link
Member

@ijsong ijsong commented Feb 25, 2024

What this PR does

This PR preallocates pkg/varlog.(*transmitter).transmitQueue.

Benchmark:

goos: darwin
goarch: amd64
pkg: github.com/kakao/varlog/pkg/varlog
cpu: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
                     │ out.NoAlloc │            out.PreAlloc             │
                     │   sec/op    │   sec/op     vs base                │
TransmitQueue/128-8    17.88µ ± 1%   16.57µ ± 0%   -7.34% (p=0.000 n=20)
TransmitQueue/1024-8   149.7µ ± 0%   136.3µ ± 0%   -8.93% (p=0.000 n=20)
TransmitQueue/8192-8   1.313m ± 1%   1.156m ± 0%  -11.97% (p=0.000 n=20)
geomean                152.0µ        137.7µ        -9.43%

                     │  out.NoAlloc  │             out.PreAlloc             │
                     │     B/op      │     B/op      vs base                │
TransmitQueue/128-8     14.40Ki ± 0%   12.29Ki ± 0%  -14.65% (p=0.000 n=20)
TransmitQueue/1024-8   138.40Ki ± 0%   98.04Ki ± 0%  -29.16% (p=0.000 n=20)
TransmitQueue/8192-8   1114.4Ki ± 0%   768.0Ki ± 0%  -31.08% (p=0.000 n=20)
geomean                 130.5Ki        97.45Ki       -25.31%

                     │ out.NoAlloc │            out.PreAlloc            │
                     │  allocs/op  │  allocs/op   vs base               │
TransmitQueue/128-8     138.0 ± 0%    131.0 ± 0%  -5.07% (p=0.000 n=20)
TransmitQueue/1024-8   1.038k ± 0%   1.027k ± 0%  -1.06% (p=0.000 n=20)
TransmitQueue/8192-8   8.211k ± 0%   8.195k ± 0%  -0.19% (p=0.000 n=20)
geomean                1.056k        1.033k       -2.13%

@ijsong ijsong self-assigned this Feb 25, 2024
@ijsong ijsong marked this pull request as draft February 25, 2024 13:06
@ijsong ijsong force-pushed the perf_subscriber_lastsubscribeat branch from a66b30e to e1ef1ad Compare February 25, 2024 13:15
@ijsong ijsong force-pushed the perf_subscriber_lastsubscribeat branch from e1ef1ad to 416e9f9 Compare February 25, 2024 14:54
Copy link

codecov bot commented Feb 25, 2024

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 49.65%. Comparing base (6d2779e) to head (58a5c21).

Files Patch % Lines
pkg/varlog/subscribe.go 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #721      +/-   ##
==========================================
- Coverage   49.73%   49.65%   -0.08%     
==========================================
  Files         235      235              
  Lines       20718    20723       +5     
==========================================
- Hits        10304    10291      -13     
- Misses       9775     9786      +11     
- Partials      639      646       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ijsong ijsong force-pushed the perf_subscriber_lastsubscribeat branch from 416e9f9 to e74d9c6 Compare February 26, 2024 14:44
@ijsong ijsong force-pushed the perf_subscriber_lastsubscribeat branch from e74d9c6 to 43444d0 Compare February 28, 2024 00:23
@ijsong ijsong force-pushed the perf_subscriber_lastsubscribeat branch from 43444d0 to c43198f Compare February 28, 2024 04:23
@ijsong ijsong force-pushed the perf_subscriber_lastsubscribeat branch from c43198f to a4f18ee Compare February 28, 2024 04:31
@ijsong ijsong force-pushed the perf_subscriber_lastsubscribeat branch from a4f18ee to 48a2b26 Compare February 28, 2024 04:49
@ijsong ijsong marked this pull request as ready for review February 28, 2024 04:50
@ijsong ijsong force-pushed the perf_subscriber_lastsubscribeat branch from 48a2b26 to a58015b Compare March 5, 2024 07:02
@ijsong ijsong force-pushed the perf_pq_prealloc branch from 1e93669 to 43ba3be Compare March 5, 2024 07:02
@ijsong
Copy link
Member Author

ijsong commented Mar 5, 2024

Merge activity

  • Mar 5, 4:41 AM EST: @ijsong started a stack merge that includes this pull request via Graphite.
  • Mar 5, 4:59 AM EST: Graphite rebased this pull request as part of a merge.
  • Mar 5, 5:06 AM EST: Graphite couldn't merge this PR because it was not satisfying all requirements.

@ijsong ijsong force-pushed the perf_subscriber_lastsubscribeat branch from a58015b to 617bd9d Compare March 5, 2024 09:50
Base automatically changed from perf_subscriber_lastsubscribeat to main March 5, 2024 09:58
This PR preallocates `pkg/varlog.(*transmitter).transmitQueue`.

Benchmark:

```
goos: darwin
goarch: amd64
pkg: github.com/kakao/varlog/pkg/varlog
cpu: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
                     │ out.NoAlloc │            out.PreAlloc             │
                     │   sec/op    │   sec/op     vs base                │
TransmitQueue/128-8    17.88µ ± 1%   16.57µ ± 0%   -7.34% (p=0.000 n=20)
TransmitQueue/1024-8   149.7µ ± 0%   136.3µ ± 0%   -8.93% (p=0.000 n=20)
TransmitQueue/8192-8   1.313m ± 1%   1.156m ± 0%  -11.97% (p=0.000 n=20)
geomean                152.0µ        137.7µ        -9.43%

                     │  out.NoAlloc  │             out.PreAlloc             │
                     │     B/op      │     B/op      vs base                │
TransmitQueue/128-8     14.40Ki ± 0%   12.29Ki ± 0%  -14.65% (p=0.000 n=20)
TransmitQueue/1024-8   138.40Ki ± 0%   98.04Ki ± 0%  -29.16% (p=0.000 n=20)
TransmitQueue/8192-8   1114.4Ki ± 0%   768.0Ki ± 0%  -31.08% (p=0.000 n=20)
geomean                 130.5Ki        97.45Ki       -25.31%

                     │ out.NoAlloc │            out.PreAlloc            │
                     │  allocs/op  │  allocs/op   vs base               │
TransmitQueue/128-8     138.0 ± 0%    131.0 ± 0%  -5.07% (p=0.000 n=20)
TransmitQueue/1024-8   1.038k ± 0%   1.027k ± 0%  -1.06% (p=0.000 n=20)
TransmitQueue/8192-8   8.211k ± 0%   8.195k ± 0%  -0.19% (p=0.000 n=20)
geomean                1.056k        1.033k       -2.13%
```
@ijsong ijsong force-pushed the perf_pq_prealloc branch from 43ba3be to 58a5c21 Compare March 5, 2024 09:58
@ijsong ijsong merged commit 26ed1a6 into main Mar 5, 2024
11 checks passed
@ijsong ijsong deleted the perf_pq_prealloc branch March 5, 2024 11:03
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