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

*: reduce unsafe usage #8482

Merged
merged 2 commits into from
Aug 6, 2024
Merged

*: reduce unsafe usage #8482

merged 2 commits into from
Aug 6, 2024

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented Aug 2, 2024

What problem does this PR solve?

Issue Number: Ref #8475.

What is changed and how does it work?

With go1.22.5

goos: darwin
goarch: arm64
pkg: example
BenchmarkStringToBytesUnsafe
BenchmarkStringToBytesUnsafe-10     	1000000000	         0.4982 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringToBytesCasting
BenchmarkStringToBytesCasting-10    	1000000000	         0.3228 ns/op	       0 B/op	       0 allocs/op
BenchmarkBytesToStringUnsafe
BenchmarkBytesToStringUnsafe-10     	1000000000	         0.5196 ns/op	       0 B/op	       0 allocs/op
BenchmarkBytesToStringCasting
BenchmarkBytesToStringCasting-10    	495765508	         2.401 ns/op	       0 B/op	       0 allocs/op

Check List

Tests

  • Unit test

Release note

None.

Signed-off-by: Ryan Leung <[email protected]>
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the dco. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 2, 2024
Copy link

codecov bot commented Aug 2, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 77.32%. Comparing base (838ee79) to head (92e7f84).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8482      +/-   ##
==========================================
+ Coverage   77.30%   77.32%   +0.02%     
==========================================
  Files         472      472              
  Lines       61789    61780       -9     
==========================================
+ Hits        47766    47773       +7     
+ Misses      10448    10441       -7     
+ Partials     3575     3566       -9     
Flag Coverage Δ
unittests 77.32% <85.71%> (+0.02%) ⬆️

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

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Aug 2, 2024
@@ -2142,7 +2142,7 @@ func HexRegionKey(key []byte) []byte {
// HexRegionKeyStr converts region key to hex format. Used for formatting region in
// logs.
func HexRegionKeyStr(key []byte) string {
return typeutil.BytesToString(HexRegionKey(key))
return string(HexRegionKey(key))
Copy link
Contributor

Choose a reason for hiding this comment

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

could you refer to relative go changes?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

ti-chi-bot bot commented Aug 6, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JmPotato, lhy1024

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 6, 2024
Copy link
Contributor

ti-chi-bot bot commented Aug 6, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-02 07:55:11.875803577 +0000 UTC m=+76109.094565182: ☑️ agreed by JmPotato.
  • 2024-08-06 03:46:18.242534774 +0000 UTC m=+323708.109633863: ☑️ agreed by lhy1024.

@ti-chi-bot ti-chi-bot bot merged commit 3b0851a into tikv:master Aug 6, 2024
25 checks passed
@rleungx rleungx deleted the reduce-unsafe branch August 13, 2024 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved dco-signoff: yes Indicates the PR's author has signed the dco. lgtm 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants