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

quicvarint: add a function to parse a varint from a byte slice #4475

Merged
merged 1 commit into from
May 3, 2024

Conversation

marten-seemann
Copy link
Member

@marten-seemann marten-seemann commented May 3, 2024

Part of #4477.

The performance difference is quite large, especially for longer varints:

goos: darwin
goarch: arm64
pkg: github.com/quic-go/quic-go/quicvarint
BenchmarkRead
BenchmarkRead/1-byte
BenchmarkRead/1-byte-16         	361651708	         3.380 ns/op
BenchmarkRead/2-byte
BenchmarkRead/2-byte-16         	257981850	         4.648 ns/op
BenchmarkRead/4-byte
BenchmarkRead/4-byte-16         	168197124	         7.102 ns/op
BenchmarkRead/8-byte
BenchmarkRead/8-byte-16         	96493723	        12.29 ns/op
BenchmarkParse
BenchmarkParse/1-byte
BenchmarkParse/1-byte-16        	514354692	         2.195 ns/op
BenchmarkParse/2-byte
BenchmarkParse/2-byte-16        	522608250	         2.244 ns/op
BenchmarkParse/4-byte
BenchmarkParse/4-byte-16        	556674920	         2.165 ns/op
BenchmarkParse/8-byte
BenchmarkParse/8-byte-16        	497475228	         2.449 ns/op

Copy link

codecov bot commented May 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.94%. Comparing base (0d565fc) to head (3fa2807).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4475      +/-   ##
==========================================
+ Coverage   84.88%   84.94%   +0.07%     
==========================================
  Files         154      154              
  Lines       14647    14685      +38     
==========================================
+ Hits        12432    12474      +42     
+ Misses       1702     1697       -5     
- Partials      513      514       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marten-seemann marten-seemann changed the title quicvarint: add function to parse a varint from a byte slice quicvarint: add a function to parse a varint from a byte slice May 3, 2024
@marten-seemann marten-seemann merged commit 1111122 into master May 3, 2024
34 checks passed
@marten-seemann marten-seemann deleted the quicvarint-slice-parsing branch May 3, 2024 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant