-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Save additional copies on byte[] and String REST resources #47198
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
Conversation
@tsegismont This is for you as well bud; both because it involves some inner Netty behaviour and because it likely show some existing gap in Vertx Buffer's impl itself |
Status for workflow
|
@franz1981 this looks interesting, have you got a significant improvement, in plain text benchmark? |
I checked that there was no regression; but in our perf tests we tends to use the blocking worker pool and not running on the I/O thread - so it is less evident what improvement you got since the main bottleneck there is the thread handoff. We should add some more test which uses byte[] in the I/O thread instead: IDK if @geoand got some idea for the byte[] case since I have noticed that is fairly tested in our Quarkus tests so maybe is used way more than I was expecting (for common user scenarios) - and that means can be a nice additional test to have too. |
Similarly to #46936 this is saving multiple copies before sending an HTTP response to the wire
e.g.
before this PR (for String):
If Http 1.1:
after this PR (for String):
I can modify as well the
String
allocation to perform exact length check - or by using reflection, I can ask to the String itself (using thecoder
field into it) if is a latin one, in O(1) - but I don't want to push this too far.For the byte[] case instead, there's a similar story (since Buffer.buffer(byte[]) perform another copy in a vertx heap based buffer, but there's no drawback when it comes with preallocated capacity.