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

datum: remove wrong usage of pool and prealloc the buffer #59331

Merged
merged 4 commits into from
Feb 8, 2025

Conversation

hawkingrei
Copy link
Member

@hawkingrei hawkingrei commented Feb 7, 2025

What problem does this PR solve?

Issue Number: close #59332

Problem Summary:

What changed and how does it work?

1、reuse strings.Builder, but it cannot reuse buffer in the builder. so it is unnecessary to reuse builder
2、prealloc the buffer in the builder.

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 do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked labels Feb 7, 2025
Copy link

codecov bot commented Feb 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.4888%. Comparing base (f7759f5) to head (7ea108f).
Report is 1 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #59331        +/-   ##
================================================
+ Coverage   73.0995%   73.4888%   +0.3893%     
================================================
  Files          1690       1690                
  Lines        467066     467102        +36     
================================================
+ Hits         341423     343268      +1845     
+ Misses       104684     102883      -1801     
+ Partials      20959      20951         -8     
Flag Coverage Δ
integration 43.0889% <100.0000%> (?)
unit 72.2404% <100.0000%> (-0.0429%) ⬇️

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

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

@hawkingrei hawkingrei requested a review from lance6716 February 8, 2025 02:36
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 8, 2025
Copy link
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Feb 8, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qw4990, zimulala

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 Feb 8, 2025
Copy link

ti-chi-bot bot commented Feb 8, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-02-08 02:43:44.332483204 +0000 UTC m=+65266.728705263: ☑️ agreed by qw4990.
  • 2025-02-08 03:02:50.60037603 +0000 UTC m=+66412.996598092: ☑️ agreed by zimulala.

Copy link
Contributor

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

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

we can store the []byte in pool and wrap it with bytes.NewBuffer.

@ti-chi-bot ti-chi-bot bot merged commit 002a1a7 into pingcap:master Feb 8, 2025
24 checks passed
@hawkingrei
Copy link
Member Author

we can store the []byte in pool and wrap it with bytes.NewBuffer.

it is a good idea and we use strings.builder in many placement. so we can optimize it together.

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. 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.

avoid slicesgrow in the types.DatumsToString
4 participants