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

colexecspan: optimize some allocations #81997

Merged
merged 2 commits into from
Jun 1, 2022

Conversation

yuzefovich
Copy link
Member

@yuzefovich yuzefovich commented May 28, 2022

bench: add benchmark of index joins on a table with two column families

Release note: None

colexecspan: optimize some allocations

This commit pre-allocates a large byte slice for all column-family
specific spans for a single row, reducing the number of allocations. It
also removes an unnecessary allocation in a single-column family case
for EndKey - PrefixEnd itself already allocates memory.

name                                           old time/op    new time/op    delta
IndexJoinColumnFamilies/Cockroach-24             8.98ms ± 4%    8.96ms ± 3%    ~     (p=0.631 n=10+10)
IndexJoinColumnFamilies/MultinodeCockroach-24    12.3ms ± 4%    12.4ms ± 5%    ~     (p=0.971 n=10+10)

name                                           old alloc/op   new alloc/op   delta
IndexJoinColumnFamilies/Cockroach-24             1.72MB ± 1%    1.71MB ± 1%  -0.59%  (p=0.000 n=10+10)
IndexJoinColumnFamilies/MultinodeCockroach-24    2.58MB ± 1%    2.56MB ± 3%    ~     (p=0.218 n=10+10)

name                                           old allocs/op  new allocs/op  delta
IndexJoinColumnFamilies/Cockroach-24              13.9k ± 1%     12.9k ± 0%  -7.41%  (p=0.000 n=10+10)
IndexJoinColumnFamilies/MultinodeCockroach-24     19.6k ± 1%     18.6k ± 1%  -5.21%  (p=0.000 n=10+9)

Release note: None

@yuzefovich yuzefovich requested review from mgartner, michae2 and a team May 28, 2022 00:36
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@yuzefovich yuzefovich marked this pull request as draft May 28, 2022 01:02
@yuzefovich
Copy link
Member Author

Hold off on reviewing for now, there seem to be some legitimate failures.

This commit pre-allocates a large byte slice for all column-family
specific spans for a single row, reducing the number of allocations. It
also removes an unnecessary allocation in a single-column family case
for `EndKey` - `PrefixEnd` itself already allocates memory.
```
name                                           old time/op    new time/op    delta
IndexJoinColumnFamilies/Cockroach-24             8.98ms ± 4%    8.96ms ± 3%    ~     (p=0.631 n=10+10)
IndexJoinColumnFamilies/MultinodeCockroach-24    12.3ms ± 4%    12.4ms ± 5%    ~     (p=0.971 n=10+10)

name                                           old alloc/op   new alloc/op   delta
IndexJoinColumnFamilies/Cockroach-24             1.72MB ± 1%    1.71MB ± 1%  -0.59%  (p=0.000 n=10+10)
IndexJoinColumnFamilies/MultinodeCockroach-24    2.58MB ± 1%    2.56MB ± 3%    ~     (p=0.218 n=10+10)

name                                           old allocs/op  new allocs/op  delta
IndexJoinColumnFamilies/Cockroach-24              13.9k ± 1%     12.9k ± 0%  -7.41%  (p=0.000 n=10+10)
IndexJoinColumnFamilies/MultinodeCockroach-24     19.6k ± 1%     18.6k ± 1%  -5.21%  (p=0.000 n=10+9)
```

Release note: None
@yuzefovich yuzefovich marked this pull request as ready for review June 1, 2022 00:34
@yuzefovich
Copy link
Member Author

Alright, @mgartner, @michae2, RFAL.

Copy link
Collaborator

@michae2 michae2 left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 2 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @mgartner)

@yuzefovich
Copy link
Member Author

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Jun 1, 2022

Build failed (retrying...):

@craig craig bot merged commit f026bc1 into cockroachdb:master Jun 1, 2022
@craig
Copy link
Contributor

craig bot commented Jun 1, 2022

Build succeeded:

@yuzefovich yuzefovich deleted the colexecspan branch June 1, 2022 19:33
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.

3 participants