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

Do not pre-allocate memory when init vector stream #11211

Closed
wants to merge 1 commit into from

Conversation

tanjialiang
Copy link
Contributor

@tanjialiang tanjialiang commented Oct 10, 2024

When creating and initializing vector streams we pre-allocate memory for all rows. This will cause unnecessary memory waste when the actual serialized row have many nulls. The null rows will not be serialized as payload, hence make use of the pre-allocated memory. Remove the pre-allocation to increase memory efficiency.
Memory usage of presto serializer decreased by up to 10x for some meta internal data.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 10, 2024
Copy link

netlify bot commented Oct 10, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 610343e
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/67086f8e0cd3ba0008e9f6f5

@facebook-github-bot
Copy link
Contributor

@tanjialiang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@tanjialiang tanjialiang marked this pull request as ready for review October 10, 2024 17:26
@tanjialiang tanjialiang changed the title [WIP] PO DEBUG Do not pre-allocate memory when init vector stream Oct 10, 2024
@facebook-github-bot
Copy link
Contributor

@tanjialiang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@xiaoxmeng xiaoxmeng left a comment

Choose a reason for hiding this comment

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

@tanjialiang nice catch. Maybe shadow in batch production for 1hr duration to see if there is any regression. Please help @kevinwilfong take a look. Thanks!

@@ -350,6 +350,9 @@ void ByteOutputStream::extend(int32_t bytes) {
ranges_.emplace_back();
current_ = &ranges_.back();
lastRangeEnd_ = 0;
if (bytes == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we check this early right after the check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really. We need above code to initialize the above members.

@facebook-github-bot
Copy link
Contributor

@tanjialiang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@tanjialiang merged this pull request in daeff59.

Copy link

Conbench analyzed the 1 benchmark run on commit daeff594.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants