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: Add tests for MergePartTopN2GlobalTopN #45900

Merged

Conversation

Rustin170506
Copy link
Member

@Rustin170506 Rustin170506 commented Aug 8, 2023

What problem does this PR solve?

Issue Number: ref #45899

Problem Summary:

What is changed and how it works?

  • Add normal tests for MergePartTopN2GlobalTopN
  • Update outdated comment.
  • Add benchmark tests

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

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

None

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 8, 2023
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
@codecov
Copy link

codecov bot commented Aug 8, 2023

Codecov Report

Merging #45900 (3b258ad) into master (a626b05) will decrease coverage by 0.6837%.
Report is 35 commits behind head on master.
The diff coverage is 50.0000%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #45900        +/-   ##
================================================
- Coverage   73.3609%   72.6773%   -0.6837%     
================================================
  Files          1272       1298        +26     
  Lines        393070     399558      +6488     
================================================
+ Hits         288360     290388      +2028     
- Misses        86347      90709      +4362     
- Partials      18363      18461        +98     
Flag Coverage Δ
integration 25.5680% <25.0000%> (?)
unit 73.3507% <50.0000%> (-0.0103%) ⬇️

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

Components Coverage Δ
dumpling 54.0444% <ø> (ø)
parser 85.0494% <ø> (+0.0135%) ⬆️
br 47.6445% <ø> (-4.4002%) ⬇️

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 8, 2023
@Rustin170506 Rustin170506 marked this pull request as draft August 9, 2023 07:13
@ti-chi-bot ti-chi-bot bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 9, 2023
@Rustin170506 Rustin170506 changed the title statistics: Add tests for MergePartTopN2GlobalTopN WIP: statistics: Add tests for MergePartTopN2GlobalTopN Aug 9, 2023
require.Len(t, leftTopN, 1, "should have 1 left topN")
}

func TestMergePartTopN2GlobalTopNWithHists(t *testing.T) {
Copy link
Member Author

@Rustin170506 Rustin170506 Aug 9, 2023

Choose a reason for hiding this comment

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

I am not sure if these TopNs and Hists make sense.

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
@Rustin170506
Copy link
Member Author

Rustin170506 commented Aug 9, 2023

Before:

Benchmark Iterations Time per Operation Memory Allocated Allocations per Operation
BenchmarkMergePartTopN2GlobalTopNWithHists100-8 85184 13737 ns/op 4408 B/op 53 allocs/op
BenchmarkMergePartTopN2GlobalTopNWithHists1000-8 8985 136583 ns/op 40696 B/op 503 allocs/op
BenchmarkMergePartTopN2GlobalTopNWithHists10000-8 702 1637701 ns/op 405880 B/op 5003 allocs/op
BenchmarkMergePartTopN2GlobalTopNWithHists100000-8 48 23604707 ns/op 4000376 B/op 50003 allocs/op
BenchmarkMergePartTopN2GlobalTopNWithHists1000000-8 5 235231317 ns/op 40002699 B/op 500003 allocs/op
BenchmarkMergePartTopN2GlobalTopNWithHists10000000-8 1 17470526833 ns/op 400001144 B/op 5000003 allocs/op

After: #45718

Benchmark Iterations Time per Operation Memory Allocated Allocations per Operation
BenchmarkMergePartTopN2GlobalTopNWithHists100-8 103918 11497 ns/op 120 B/op 2 allocs/op
BenchmarkMergePartTopN2GlobalTopNWithHists1000-8 10000 113324 ns/op 120 B/op 2 allocs/op
BenchmarkMergePartTopN2GlobalTopNWithHists10000-8 909 1308099 ns/op 120 B/op 2 allocs/op
BenchmarkMergePartTopN2GlobalTopNWithHists100000-8 63 17689263 ns/op 120 B/op 2 allocs/op
BenchmarkMergePartTopN2GlobalTopNWithHists1000000-8 6 180973042 ns/op 120 B/op 2 allocs/op
BenchmarkMergePartTopN2GlobalTopNWithHists10000000-8 1 8101635583 ns/op 120 B/op 2 allocs/op

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
@Rustin170506 Rustin170506 changed the title WIP: statistics: Add tests for MergePartTopN2GlobalTopN statistics: Add tests for MergePartTopN2GlobalTopN Aug 9, 2023
@Rustin170506 Rustin170506 marked this pull request as ready for review August 9, 2023 09:18
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 9, 2023
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Aug 9, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 9, 2023

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Aug 9, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 9, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-08-09 09:28:52.905933368 +0000 UTC m=+104897.454949354: ☑️ agreed by hawkingrei.
  • 2023-08-09 09:36:49.122238899 +0000 UTC m=+105373.671254887: ☑️ agreed by qw4990.

@hawkingrei
Copy link
Member

/retest

2 similar comments
@Rustin170506
Copy link
Member Author

/retest

@hawkingrei
Copy link
Member

/retest

@ti-chi-bot ti-chi-bot bot merged commit 96805cf into pingcap:master Aug 9, 2023
3 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.5 affects-7.1 approved lgtm 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.

3 participants