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

HTTP2StreamChannel.dropPendingReads allocates unnecessarily #240

Closed
Lukasa opened this issue Sep 18, 2020 · 0 comments · Fixed by #243
Closed

HTTP2StreamChannel.dropPendingReads allocates unnecessarily #240

Lukasa opened this issue Sep 18, 2020 · 0 comments · Fixed by #243
Labels
area/performance Improvements to performance. kind/enhancement Improvements to existing feature.

Comments

@Lukasa
Copy link
Contributor

Lukasa commented Sep 18, 2020

HTTP2StreamChannel drops the pending reads by allocating a new CircularBuffer. There's no need for that, just use removeAll: it's faster.

@Lukasa Lukasa added kind/enhancement Improvements to existing feature. area/performance Improvements to performance. labels Sep 18, 2020
glbrntt added a commit to glbrntt/swift-nio-http2 that referenced this issue Sep 22, 2020
Motivation:

Unnecessary allocations are bad!

Modifications:

- Use 'removeAll' instead of allocating a new buffer when dropping
  pending reads in the 'HTTP2StreamChannel'
- Use a static empty buffer in 'DataBuffer.evacuatePendingWrites'

Result:

- Fewer allocations.
- Resolves apple#240
- Resolves apple#241
glbrntt added a commit to glbrntt/swift-nio-http2 that referenced this issue Sep 22, 2020
Motivation:

Unnecessary allocations are bad!

Modifications:

- Use 'removeAll' instead of allocating a new buffer when dropping
  pending reads in the 'HTTP2StreamChannel'
- Use a static empty buffer in 'DataBuffer.evacuatePendingWrites'

Result:

- Fewer allocations.
- Resolves apple#240
- Resolves apple#241
Lukasa pushed a commit that referenced this issue Sep 22, 2020
Motivation:

Unnecessary allocations are bad!

Modifications:

- Use 'removeAll' instead of allocating a new buffer when dropping
  pending reads in the 'HTTP2StreamChannel'
- Use a static empty buffer in 'DataBuffer.evacuatePendingWrites'

Result:

- Fewer allocations.
- Resolves #240
- Resolves #241
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/performance Improvements to performance. kind/enhancement Improvements to existing feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant