Skip to content

storage: avoid heap allocation per value in pebbleIterator.FindSplitKey#58120

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/splitUnsafeKey
Dec 21, 2020
Merged

storage: avoid heap allocation per value in pebbleIterator.FindSplitKey#58120
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/splitUnsafeKey

Conversation

@nvb
Copy link
Copy Markdown
Contributor

@nvb nvb commented Dec 21, 2020

This was fallout from 95b836d. pebble.Iterator.Value is unsafe (no copy) but pebbleIterator.Value is safe (alloc + copy).

name                                     old time/op    new time/op    delta
MVCCFindSplitKey_Pebble/valueSize=32-16    97.0ms ± 5%    76.5ms ±15%   -21.08%  (p=0.000 n=9+10)

name                                     old speed      new speed      delta
MVCCFindSplitKey_Pebble/valueSize=32-16   693MB/s ± 5%   881MB/s ±13%   +27.19%  (p=0.000 n=9+10)

name                                     old alloc/op   new alloc/op   delta
MVCCFindSplitKey_Pebble/valueSize=32-16    27.8MB ± 0%     0.0MB ±27%   -99.99%  (p=0.000 n=10+10)

name                                     old allocs/op  new allocs/op  delta
MVCCFindSplitKey_Pebble/valueSize=32-16      580k ± 0%        0k ± 0%  -100.00%  (p=0.000 n=10+9)

At the end of a 4 hour, 2.2 TB IMPORT of TPC-E, this was responsible for 15.96% of all heap allocations (by object).

Screen Shot 2020-12-20 at 10 13 35 PM

This was fallout from 95b836d.

```
name                                     old time/op    new time/op    delta
MVCCFindSplitKey_Pebble/valueSize=32-16    97.0ms ± 5%    76.5ms ±15%   -21.08%  (p=0.000 n=9+10)

name                                     old speed      new speed      delta
MVCCFindSplitKey_Pebble/valueSize=32-16   693MB/s ± 5%   881MB/s ±13%   +27.19%  (p=0.000 n=9+10)

name                                     old alloc/op   new alloc/op   delta
MVCCFindSplitKey_Pebble/valueSize=32-16    27.8MB ± 0%     0.0MB ±27%   -99.99%  (p=0.000 n=10+10)

name                                     old allocs/op  new allocs/op  delta
MVCCFindSplitKey_Pebble/valueSize=32-16      580k ± 0%        0k ± 0%  -100.00%  (p=0.000 n=10+9)
```

At the end of a 4 hour, 2.2 TB IMPORT of TPC-E, this was responsible for
15.96% of all heap allocations (by object).
@nvb nvb requested a review from sumeerbhola December 21, 2020 03:22
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Collaborator

@sumeerbhola sumeerbhola left a comment

Choose a reason for hiding this comment

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

glad you found this!

:lgtm:

Reviewed 1 of 1 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Dec 21, 2020

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 21, 2020

Build succeeded:

@craig craig bot merged commit e552218 into cockroachdb:master Dec 21, 2020
@nvb nvb deleted the nvanbenschoten/splitUnsafeKey branch December 31, 2020 06:11
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