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

Improve performance of boundaryReader #170

Merged
merged 1 commit into from
Oct 26, 2020
Merged

Conversation

dcormier
Copy link
Contributor

Explicitly read/write a single byte rather than using io.CopyN to copy a single byte.

Before the change:

BenchmarkBoundaryReader-12    	  544516	      1909 ns/op	    6704 B/op	      15 allocs/op

After:

BenchmarkBoundaryReader-12    	 1039579	      1067 ns/op	    4495 B/op	       7 allocs/op

From 15 allocs/op down to 7.

Fixes #169.

@coveralls
Copy link

coveralls commented Oct 26, 2020

Coverage Status

Coverage decreased (-0.08%) to 95.375% when pulling 7ac22f4 on dcormier:master into 2a0b399 on jhillyerd:master.

@dcormier dcormier changed the title Improve performance of bounaryReader Improve performance of boundaryReader Oct 26, 2020
Explicitly read/write a single byte rather than using `io.CopyN` to copy a single byte.

Before the change:

```
BenchmarkBoundaryReader-12    	  544516	      1909 ns/op	    6704 B/op	      15 allocs/op
```

After:
```
BenchmarkBoundaryReader-12    	 1039579	      1067 ns/op	    4495 B/op	       7 allocs/op
```

From 15 allocs/op down to 7.

Fixes jhillyerd#169.
@jhillyerd
Copy link
Owner

Excellent, thank you

@jhillyerd jhillyerd merged commit 1f3be34 into jhillyerd:master Oct 26, 2020
@dcormier
Copy link
Contributor Author

dcormier commented Oct 26, 2020

Any interest in tagging a release for that, @jhillyerd? I think it'd be nice to get that out there.

@jhillyerd
Copy link
Owner

Going to hold off for a bit because of the recent post to #140. I suspect we are going to need to roll the continuation parsing code back to a state where it just follows the RFCs.

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.

Huge number of allocations in boundaryReader.Read
3 participants