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: BCE for BinarySearchRemoveVal #49871

Merged
merged 2 commits into from
Dec 28, 2023

Conversation

hawkingrei
Copy link
Member

@hawkingrei hawkingrei commented Dec 28, 2023

What problem does this PR solve?

Issue Number: close #49876

Problem Summary:

What changed and how does it work?

Check List

Tests

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

before

pkg/statistics/histogram.go:304:49: Found IsInBounds
pkg/statistics/histogram.go:304:59: Found IsSliceInBounds
pkg/statistics/histogram.go:304:59: Found IsInBounds
pkg/statistics/histogram.go:307:49: Found IsInBounds
pkg/statistics/histogram.go:307:59: Found IsSliceInBounds
pkg/statistics/histogram.go:307:59: Found IsInBounds
pkg/statistics/histogram.go:315:46: Found IsInBounds
pkg/statistics/histogram.go:315:56: Found IsSliceInBounds
pkg/statistics/histogram.go:315:56: Found IsInBounds
pkg/statistics/histogram.go:320:45: Found IsInBounds

after

pkg/statistics/histogram.go:302:28: Found IsInBounds
pkg/statistics/histogram.go:305:46: Found IsSliceInBounds
pkg/statistics/histogram.go:305:46: Found IsInBounds
pkg/statistics/histogram.go:308:46: Found IsSliceInBounds
pkg/statistics/histogram.go:308:46: Found IsInBounds
pkg/statistics/histogram.go:316:43: Found IsSliceInBounds
pkg/statistics/histogram.go:316:43: Found IsInBounds
pkg/statistics/histogram.go:321:42: Found IsSliceInBounds
pkg/statistics/histogram.go:321:42: Found IsInBounds

gobench

go test -run=^$ -bench=BenchmarkMergePartTopN2GlobalTopNWithHists -benchmem github.com/pingcap/tidb/pkg/statistics/handle/globalstats

before

goos: darwin
goarch: arm64
pkg: github.com/pingcap/tidb/pkg/statistics/handle/globalstats
BenchmarkMergePartTopN2GlobalTopNWithHists/Size100-8                 231           5237536 ns/op          177657 B/op         30 allocs/op
BenchmarkMergePartTopN2GlobalTopNWithHists/Size1000-8                 14          74706851 ns/op          177771 B/op         30 allocs/op
BenchmarkMergePartTopN2GlobalTopNWithHists/Size2000-8                  6         187332771 ns/op          176674 B/op         29 allocs/op
BenchmarkMergePartTopN2GlobalTopNWithHists/Size5000-8                  2         872378271 ns/op          179360 B/op         34 allocs/op
BenchmarkMergePartTopN2GlobalTopNWithHists/Size10000-8                 1        2077151917 ns/op          176776 B/op         31 allocs/op
PASS
ok      github.com/pingcap/tidb/pkg/statistics/handle/globalstats       14.021s

after

goos: darwin
goarch: arm64
pkg: github.com/pingcap/tidb/pkg/statistics/handle/globalstats
BenchmarkMergePartTopN2GlobalTopNWithHists/Size100-8                 230           5141669 ns/op          177722 B/op         30 allocs/op
BenchmarkMergePartTopN2GlobalTopNWithHists/Size1000-8                 16          63135646 ns/op          177431 B/op         29 allocs/op
BenchmarkMergePartTopN2GlobalTopNWithHists/Size2000-8                  6         182425965 ns/op          178802 B/op         32 allocs/op
BenchmarkMergePartTopN2GlobalTopNWithHists/Size5000-8                  2         988736625 ns/op          177200 B/op         29 allocs/op
BenchmarkMergePartTopN2GlobalTopNWithHists/Size10000-8                 1        2049309958 ns/op          179432 B/op         33 allocs/op
PASS
ok      github.com/pingcap/tidb/pkg/statistics/handle/globalstats       13.125s

  • 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: Weizhen Wang <wangweizhen@pingcap.com>
@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/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed do-not-merge/needs-tests-checked labels Dec 28, 2023
Copy link

codecov bot commented Dec 28, 2023

Codecov Report

Merging #49871 (63f3dd2) into master (3b41717) will increase coverage by 0.3716%.
Report is 3 commits behind head on master.
The diff coverage is 0.0000%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #49871        +/-   ##
================================================
+ Coverage   70.9364%   71.3081%   +0.3716%     
================================================
  Files          1368       1430        +62     
  Lines        396039     415898     +19859     
================================================
+ Hits         280936     296569     +15633     
- Misses        95438     100534      +5096     
+ Partials      19665      18795       -870     
Flag Coverage Δ
integration 43.8063% <0.0000%> (?)
unit 70.9366% <ø> (+0.0002%) ⬆️

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

Components Coverage Δ
dumpling 53.9663% <ø> (ø)
parser ∅ <ø> (∅)
br 47.1402% <ø> (-5.7382%) ⬇️

Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
Copy link
Contributor

@elsa0520 elsa0520 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 28, 2023
Copy link

ti-chi-bot bot commented Dec 28, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: elsa0520, lance6716

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 Dec 28, 2023
Copy link

ti-chi-bot bot commented Dec 28, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-12-28 06:58:21.815826263 +0000 UTC m=+1721792.853053189: ☑️ agreed by elsa0520.
  • 2023-12-28 07:01:42.403993474 +0000 UTC m=+1721993.441220403: ☑️ agreed by lance6716.

@ti-chi-bot ti-chi-bot bot merged commit e04d7a8 into pingcap:master Dec 28, 2023
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/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BCE in the Histogram.BinarySearchRemoveVal
3 participants