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

server: optimize BCE on the packetio.writePacket #34758

Merged
merged 3 commits into from
May 18, 2022

Conversation

hawkingrei
Copy link
Member

@hawkingrei hawkingrei commented May 18, 2022

Signed-off-by: Weizhen Wang wangweizhen@pingcap.com

What problem does this PR solve?

Go is a memory safe language. In array/slice element indexing and subslice operations, Go runtime will check whether or not the involved indexes are out of range. If an index is out of range, a panic will be produced to prevent the invalid index from doing harm. This is called bounds check. Bounds checks make our code run safely, on the other hand, they also make our code run a little slower.

Issue Number: ref #34669

Problem Summary:

What is changed and how it works?

before

goos: darwin
goarch: amd64
pkg: github.com/pingcap/tidb/server
cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
BenchmarkPacketIOWrite-16    	10000000	       871.3 ns/op
PASS
ok  	github.com/pingcap/tidb/server	9.875s

after

goos: darwin
goarch: amd64
pkg: github.com/pingcap/tidb/server
cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
BenchmarkPacketIOWrite-16    	10000000	       830.0 ns/op
PASS
ok  	github.com/pingcap/tidb/server	9.102s

4% performance improvement.

BTW, the performance gain increases as the data size increases.

Check List

Tests

  • Unit test
  • Integration test

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
Copy link
Member

ti-chi-bot commented May 18, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • bb7133
  • tiancaiamao

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added 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. labels May 18, 2022
@sre-bot
Copy link
Contributor

sre-bot commented May 18, 2022

@hawkingrei hawkingrei requested a review from dveeden May 18, 2022 02:25
@hawkingrei hawkingrei changed the title server: optimize bce on the packetio.writePacket server: optimize BCE on the packetio.writePacket May 18, 2022
@hawkingrei hawkingrei requested a review from tiancaiamao May 18, 2022 02:40
Copy link
Member

@bb7133 bb7133 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 added the status/LGT1 Indicates that a PR has LGTM 1. label May 18, 2022
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 18, 2022
@tiancaiamao
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 116720f

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label May 18, 2022
@hawkingrei
Copy link
Member Author

/run-mysql-test

@ti-chi-bot ti-chi-bot merged commit d2c4339 into pingcap:master May 18, 2022
@sre-bot
Copy link
Contributor

sre-bot commented May 18, 2022

TiDB MergeCI notify

🔴 Bad News! New failing [1] after this pr merged.
These new failed integration tests seem to be caused by the current PR, please try to fix these new failed integration tests, thanks!

CI Name Result Duration Compare with Parent commit
idc-jenkins-ci-tidb/integration-ddl-test 🟥 failed 1, success 5, total 6 13 min New failing
idc-jenkins-ci/integration-cdc-test 🟢 all 34 tests passed 23 min Existing passed
idc-jenkins-ci-tidb/integration-common-test 🟢 all 11 tests passed 13 min Existing passed
idc-jenkins-ci-tidb/sqllogic-test-1 🟢 all 26 tests passed 7 min 10 sec Existing passed
idc-jenkins-ci-tidb/common-test 🟢 all 12 tests passed 6 min 46 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-2 🟢 all 28 tests passed 6 min 25 sec Existing passed
idc-jenkins-ci-tidb/tics-test 🟢 all 1 tests passed 6 min 19 sec Existing passed
idc-jenkins-ci-tidb/mybatis-test 🟢 all 1 tests passed 4 min 33 sec Existing passed
idc-jenkins-ci-tidb/integration-compatibility-test 🟢 all 1 tests passed 3 min 28 sec Existing passed
idc-jenkins-ci-tidb/plugin-test 🟢 build success, plugin test success 4min Existing passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants