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

Use zero-copy approach to convert types between string and byte slice #2206

Merged
merged 3 commits into from Jan 17, 2020
Merged

Use zero-copy approach to convert types between string and byte slice #2206

merged 3 commits into from Jan 17, 2020

Conversation

panjf2000
Copy link
Contributor

Benchmark:

BenchmarkBytesConvBytesToStrRaw-4   	21003800	        70.9 ns/op	      96 B/op	       1 allocs/op
BenchmarkBytesConvBytesToStr-4      	1000000000	         0.333 ns/op	       0 B/op	       0 allocs/op
BenchmarkBytesConvStrToBytesRaw-4   	18478059	        59.3 ns/op	      96 B/op	       1 allocs/op
BenchmarkBytesConvStrToBytes-4      	1000000000	         0.373 ns/op	       0 B/op	       0 allocs/op

@codecov
Copy link

codecov bot commented Jan 14, 2020

Codecov Report

Merging #2206 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2206      +/-   ##
==========================================
+ Coverage   98.51%   98.51%   +<.01%     
==========================================
  Files          41       41              
  Lines        2285     2286       +1     
==========================================
+ Hits         2251     2252       +1     
  Misses         18       18              
  Partials       16       16
Impacted Files Coverage Δ
path.go 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d60c27...dda12b9. Read the comment docs.

@appleboy appleboy added this to the 1.6 milestone Jan 15, 2020
appleboy
appleboy previously approved these changes Jan 15, 2020
Copy link
Member

@appleboy appleboy left a comment

Choose a reason for hiding this comment

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

LGTM

@panjf2000
Copy link
Contributor Author

@appleboy
A new commit has been submitted which renames a little arg and has no impact on the main functionality, but still, it dismissed your previous approval, please take a glance at it, sorry&thanks~

@appleboy appleboy merged commit 982daeb into gin-gonic:master Jan 17, 2020
@panjf2000 panjf2000 deleted the patch-1 branch January 17, 2020 16:46
ThomasObenaus pushed a commit to ThomasObenaus/gin that referenced this pull request Feb 19, 2020
…-gonic#2206)

* Use zero-copy approach to convert types between string and byte slice

* Rename argument to a eligible one

Benchmark:

BenchmarkBytesConvBytesToStrRaw-4   	21003800	        70.9 ns/op	      96 B/op	       1 allocs/op
BenchmarkBytesConvBytesToStr-4      	1000000000	         0.333 ns/op	       0 B/op	       0 allocs/op
BenchmarkBytesConvStrToBytesRaw-4   	18478059	        59.3 ns/op	      96 B/op	       1 allocs/op
BenchmarkBytesConvStrToBytes-4      	1000000000	         0.373 ns/op	       0 B/op	       0 allocs/op


Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
byebyebruce pushed a commit to byebyebruce/gin that referenced this pull request Mar 25, 2020
…-gonic#2206)

* Use zero-copy approach to convert types between string and byte slice

* Rename argument to a eligible one

Benchmark:

BenchmarkBytesConvBytesToStrRaw-4   	21003800	        70.9 ns/op	      96 B/op	       1 allocs/op
BenchmarkBytesConvBytesToStr-4      	1000000000	         0.333 ns/op	       0 B/op	       0 allocs/op
BenchmarkBytesConvStrToBytesRaw-4   	18478059	        59.3 ns/op	      96 B/op	       1 allocs/op
BenchmarkBytesConvStrToBytes-4      	1000000000	         0.373 ns/op	       0 B/op	       0 allocs/op


Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants