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

execdetails: tiny optimization for executor stats #58186

Merged
merged 12 commits into from
Dec 17, 2024

Conversation

crazycs520
Copy link
Contributor

@crazycs520 crazycs520 commented Dec 12, 2024

What problem does this PR solve?

Issue Number: ref #56649

Problem Summary: tiny optimization for executor stats.

What changed and how does it work?

  • Avoid use fmt.sprintf
  • Use int instead of string in storeType field.

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

Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
…c-stats-avoid-sprintf

Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 12, 2024
Copy link

tiprow bot commented Dec 12, 2024

Hi @crazycs520. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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 kubernetes-sigs/prow repository.

Signed-off-by: crazycs520 <crazycs520@gmail.com>
Copy link

codecov bot commented Dec 12, 2024

Codecov Report

Attention: Patch coverage is 86.81319% with 12 lines in your changes missing coverage. Please review.

Project coverage is 73.8820%. Comparing base (db2776a) to head (b9cc3be).
Report is 16 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #58186        +/-   ##
================================================
+ Coverage   73.2468%   73.8820%   +0.6351%     
================================================
  Files          1679       1679                
  Lines        462540     463608      +1068     
================================================
+ Hits         338796     342523      +3727     
+ Misses       102958     100401      -2557     
+ Partials      20786      20684       -102     
Flag Coverage Δ
integration 43.4192% <59.3406%> (?)
unit 72.6042% <85.7142%> (+0.2192%) ⬆️

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

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 46.0230% <ø> (+0.0360%) ⬆️

@crazycs520
Copy link
Contributor Author

/retest-required

Copy link

tiprow bot commented Dec 12, 2024

@crazycs520: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest-required

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 kubernetes-sigs/prow repository.

@crazycs520 crazycs520 changed the title pkg/util/execdetails: avoid sprintf and string execdetails: tiny optimization for executor stats Dec 12, 2024
Copy link
Contributor

@zyguan zyguan left a comment

Choose a reason for hiding this comment

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

Maybe we can use a buf pool (instead of calling bytes.NewBuffer every time) to eliminate the overhead of bytes grow/copy

@crazycs520
Copy link
Contributor Author

Maybe we can use a buf pool (instead of calling bytes.NewBuffer every time) to eliminate the overhead of bytes grow/copy

Nice catch, how about pull another PR to do this, since bytes.NewBuffer is called in many places, we can change all of them.

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Dec 16, 2024
Copy link

ti-chi-bot bot commented Dec 17, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfzjywxk, zyguan

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 approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 17, 2024
Copy link

ti-chi-bot bot commented Dec 17, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-12-16 09:16:59.576048931 +0000 UTC m=+862009.664851475: ☑️ agreed by zyguan.
  • 2024-12-17 06:48:13.350931832 +0000 UTC m=+939483.439734375: ☑️ agreed by cfzjywxk.

@crazycs520
Copy link
Contributor Author

/retest-required

Copy link

tiprow bot commented Dec 17, 2024

@crazycs520: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest-required

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 kubernetes-sigs/prow repository.

@crazycs520
Copy link
Contributor Author

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Dec 17, 2024
@crazycs520
Copy link
Contributor Author

/retest-required

@hawkingrei
Copy link
Member

/retest

@crazycs520
Copy link
Contributor Author

/retest-required

@crazycs520
Copy link
Contributor Author

/retest-required

@ti-chi-bot ti-chi-bot bot merged commit 68d6b99 into pingcap:master Dec 17, 2024
24 checks passed
@crazycs520 crazycs520 deleted the opt-exec-stats-avoid-sprintf branch December 18, 2024 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants