Merged
Conversation
FranzBusch
commented
Oct 8, 2023
| @@ -0,0 +1,3 @@ | |||
| { | |||
| "mallocCountTotal" : 5636901 | |||
Member
Author
There was a problem hiding this comment.
This is pretty bad since we are allocating for every single enqueue now. I will raise one or more follow up PRs to reduce this significantly. I was able to remove all allocations except one in the runtime.
# Motivation We want to benchmark our `NIOAsyncChannel` to see how it compares to the synchronous implementation with `ChannelHandler`s # Modification This PR adds a new `TCPEchoAsyncChannel` benchmark that mimics the `TCPEcho` benchmark but uses our new async bridges. Since Swift Concurrency, is normally using a global executor this benchmark would have quite high variation. To reduce this variant I introduced code to hook the global executor and set an `EventLoop` as the executor. In the future, if we get task executors we can change the code to us them instead. # Result New baseline benchmarks for the `NIOAsyncChannel`.
8edf20d to
0cb17ae
Compare
glbrntt
approved these changes
Oct 9, 2023
| import Benchmark | ||
| import NIOPosix | ||
|
|
||
| private let eventLoop = MultiThreadedEventLoopGroup(numberOfThreads: 1).next() |
Contributor
There was a problem hiding this comment.
Should we just grab the next() from the shared singleton?
| } | ||
| } | ||
|
|
||
| let bufferSize = 10000 |
Contributor
There was a problem hiding this comment.
nit: naming threw me for a sec as I expected a buffer, not a ByteBuffer. something like messageSize is a more obvious
Member
Author
|
Thanks for the review. Going to address them in my next PR that I am going to open in a few minutes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
We want to benchmark our
NIOAsyncChannelto see how it compares to the synchronous implementation withChannelHandlersModification
This PR adds a new
TCPEchoAsyncChannelbenchmark that mimics theTCPEchobenchmark but uses our new async bridges. Since Swift Concurrency, is normally using a global executor this benchmark would have quite high variation. To reduce this variant I introduced code to hook the global executor and set anEventLoopas the executor. In the future, if we get task executors we can change the code to us them instead.Result
New baseline benchmarks for the
NIOAsyncChannel.