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

statistics: reduce small obj alloc for PreCalculateScalar #52623

Merged
merged 2 commits into from
Apr 16, 2024

Conversation

winoros
Copy link
Member

@winoros winoros commented Apr 15, 2024

What problem does this PR solve?

Issue Number: close #52343

Problem Summary:

We don't need to re-alloc anything since we only read from the chunk, no modification after reading it.

What changed and how does it work?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 15, 2024
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 15, 2024
Copy link

codecov bot commented Apr 15, 2024

Codecov Report

Merging #52623 (5cb7dfa) into master (5aa48d8) will increase coverage by 2.0646%.
Report is 11 commits behind head on master.
The diff coverage is 100.0000%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #52623        +/-   ##
================================================
+ Coverage   72.3481%   74.4128%   +2.0646%     
================================================
  Files          1470       1471         +1     
  Lines        427158     428133       +975     
================================================
+ Hits         309041     318586      +9545     
+ Misses        98845      89714      -9131     
- Partials      19272      19833       +561     
Flag Coverage Δ
integration 49.0384% <100.0000%> (?)
unit 71.1782% <100.0000%> (-0.0622%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 49.7258% <ø> (+8.6257%) ⬆️

Copy link
Member

@Rustin170506 Rustin170506 left a comment

Choose a reason for hiding this comment

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

I'm not very familiar with these structures.
Is it safe to reuse? Are there other places that use it in this way?
If it is, please add some comments to note that we trying to rescue it to save memory here.

@winoros
Copy link
Member Author

winoros commented Apr 16, 2024

I'm not very familiar with these structures. Is it safe to reuse? Are there other places that use it in this way? If it is, please add some comments to note that we trying to rescue it to save memory here.

You can jump into the func convertDatumToScalar, which calculates a float64 score for the datum. So the datum is read-only before it's destroyed.

Copy link
Member

@Rustin170506 Rustin170506 left a comment

Choose a reason for hiding this comment

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

/hold

Please add some comments to it.

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 16, 2024
Copy link

ti-chi-bot bot commented Apr 16, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hawkingrei, hi-rustin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 16, 2024
Copy link

ti-chi-bot bot commented Apr 16, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-04-15 16:35:12.119623414 +0000 UTC m=+269531.230669860: ☑️ agreed by hawkingrei.
  • 2024-04-16 11:35:50.175781818 +0000 UTC m=+337969.286828264: ☑️ agreed by hi-rustin.

@winoros
Copy link
Member Author

winoros commented Apr 16, 2024

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 16, 2024
@ti-chi-bot ti-chi-bot bot merged commit e5863e1 into pingcap:master Apr 16, 2024
23 checks passed
@winoros winoros deleted the reduce-alloc-precalcscalar branch April 16, 2024 16:20
@winoros
Copy link
Member Author

winoros commented Apr 16, 2024

/cherrypick release-8.1

@ti-chi-bot
Copy link
Member

@winoros: new pull request created to branch release-8.1: #52652.

In response to this:

/cherrypick release-8.1

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PreCalculateScalar consumes a lot of CPU when non-lite init stats
4 participants