Skip to content

sql/rowexec: don't allocate buf per row in sketchInfo.addRow#58117

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

sql/rowexec: don't allocate buf per row in sketchInfo.addRow#58117
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/importSampler

Conversation

@nvb
Copy link
Copy Markdown
Contributor

@nvb nvb commented Dec 21, 2020

The intbuf array was meant to stay on the stack, but was escaping to the heap because the call through the hash function variable was opaque to escape analysis.

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

Screen Shot 2020-12-20 at 9 58 04 PM

The `intbuf` array was meant to stay on the stack, but was escaping
to the heap because the call through the `hash` function variable was
opaque to escape analysis.

At the end of a 4 hour, 2.2 TB IMPORT of TPC-E, this was responsible
for **76.70%** of all heap allocations.
@nvb nvb requested a review from RaduBerinde December 21, 2020 03:09
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@RaduBerinde
Copy link
Copy Markdown
Member

Wow, nice find! LGTM! Can you backport to both 20.1 and 20.2?

@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Dec 21, 2020

Can you backport to both 20.1 and 20.2?

Sure!

bors r+

@craig craig bot merged commit e552218 into cockroachdb:master Dec 21, 2020
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 21, 2020

Build succeeded:

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