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

expression: update md5 hash to use hex #53003

Merged
merged 1 commit into from May 7, 2024

Conversation

qichengzx
Copy link
Contributor

@qichengzx qichengzx commented Apr 30, 2024

What problem does this PR solve?

Issue Number: close #53018
Problem Summary: md5 hash update

What changed and how does it work?

Performance optimization for md5 hash, use hex EncodeToString instead of fmt

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

Copy link

ti-chi-bot bot commented Apr 30, 2024

Welcome @qichengzx!

It looks like this is your first PR to pingcap/tidb 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/tidb. 😃

Copy link

ti-chi-bot bot commented Apr 30, 2024

Hi @qichengzx. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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/test-infra repository.

Copy link

tiprow bot commented Apr 30, 2024

Hi @qichengzx. 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/test-infra repository.

@Defined2014 Defined2014 changed the title expression:update md5 hash to use hex expression: update md5 hash to use hex May 6, 2024
Copy link

codecov bot commented May 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.6087%. Comparing base (c73d6c5) to head (e089b70).
Report is 44 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #53003        +/-   ##
================================================
+ Coverage   72.4412%   74.6087%   +2.1675%     
================================================
  Files          1482       1508        +26     
  Lines        428430     447371     +18941     
================================================
+ Hits         310360     333778     +23418     
+ Misses        98853      93626      -5227     
- Partials      19217      19967       +750     
Flag Coverage Δ
integration 49.1084% <100.0000%> (?)
unit 71.9229% <100.0000%> (+0.5980%) ⬆️

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

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

Copy link
Contributor

@Defined2014 Defined2014 left a comment

Choose a reason for hiding this comment

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

Provide a benchmark result:

MD5HashNew

goos: linux
goarch: amd64
pkg: github.com/pingcap/tidb/pkg/expression
cpu: AMD Ryzen 7 5700G with Radeon Graphics         
BenchmarkMD5Hash-16    	 7836616	       177.2 ns/op	      64 B/op	       2 allocs/op

MD5HashOld

goos: linux
goarch: amd64
pkg: github.com/pingcap/tidb/pkg/expression
cpu: AMD Ryzen 7 5700G with Radeon Graphics         
BenchmarkMD5Hash-16    	 3914863	       307.7 ns/op	      64 B/op	       3 allocs/op

Copy link

ti-chi-bot bot commented May 7, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-05-05 16:59:01.08267448 +0000 UTC m=+808494.839810055: ☑️ agreed by ngaut.
  • 2024-05-07 04:50:29.307821777 +0000 UTC m=+937583.064957349: ☑️ agreed by Defined2014.

b.ReportAllocs()
for i := 0; i < b.N; i++ {
MD5HashOld("abc")
//MD5HashNew("abc")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have both benchmarks? I.e. BenchmarkMD5HashOld and BenchmarkMD5HashNew.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we have both benchmarks? I.e. BenchmarkMD5HashOld and BenchmarkMD5HashNew.

I understand that generally only one benchmark method is used, with two specific methods executed inside, one improved and one old, and then the results are compared using the official tool benchstat

Copy link

ti-chi-bot bot commented May 7, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Defined2014, ngaut, zanmato1984

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 the approved label May 7, 2024
@ti-chi-bot ti-chi-bot bot merged commit 013a4e6 into pingcap:master May 7, 2024
21 checks passed
terry1purcell pushed a commit to terry1purcell/tidb that referenced this pull request May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test release-note-none 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.

md5 hash function issue
4 participants