-
Notifications
You must be signed in to change notification settings - Fork 84
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
Reduce allocations on InlineStreamMultiplexer/createStreamChannel
#450
Conversation
@swift-server-bot add to allowlist |
InlineStreamMultiplexer/createStreamChannel
d237287
to
c198a0f
Compare
@swift-server-bot test this please |
c198a0f
to
763e0ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good apart from fixing the warnings!
@@ -173,12 +173,13 @@ extension Channel { | |||
) | |||
} | |||
} else { | |||
let unsafePosition = UnsafeTransfer(position) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should be doing this: position
isn't sendable because it can contain a ChannelHandler
which might not be Sendable
. All we're doing here is suppressing a correct warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah this is not supposed to stay :) that's why this was just opened as draft. I just wanted to get the nightly pipeline to not fatal error (it's got warnings as errors enabled so it's been failing because of this for a while now) to double check the tests passed. But all of the pipelines seem broken right now anyways because of some Jenkins error I believe so I'll just revert this and trust in my local builds passing.
We need to fix this somehow though, or remove the warns as errors flag temporarily.
763e0ce
to
39711e2
Compare
I updated the allocations for nightly because they had been outdated for a while. However this change doesn't affect any allocation tests: this is because allocation tests that call |
I think it's probably worth adding a version of the test which doesn't pass in the promise in a separate PR and verifying that we do save allocations here. |
67812be
to
3481691
Compare
@@ -39,7 +39,7 @@ services: | |||
- MAX_ALLOCS_ALLOWED_client_server_request_response_many_inline=889050 | |||
- MAX_ALLOCS_ALLOWED_create_client_stream_channel=37050 | |||
- MAX_ALLOCS_ALLOWED_create_client_stream_channel_inline=37050 | |||
- MAX_ALLOCS_ALLOWED_create_client_stream_channel_inline_no_promise_based_API=44050 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the allocations of the newly added test in the latest commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Motivation
When creating stream channels on the
InlineStreamMultiplexer
, we are currently performing aflatSubmit
on two different codepaths. This allocates two ELFs: one onsubmit
, and one onflatMap
. This is unnecessary, as we could do with just one allocation.Modifications
Create a single ELP and call
execute
on the EL instead of usingflatSubmit
.Result
Fewer allocations