pd icon indicating copy to clipboard operation
pd copied to clipboard

*: reduce unsafe usage

Open rleungx opened this issue 7 months ago • 3 comments

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.

rleungx avatar Aug 02 '24 07:08 rleungx