-
Notifications
You must be signed in to change notification settings - Fork 588
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
simplify IncomingCommand.ReturnBuffers handling #1636
Conversation
Why? |
what exactly do you mean? |
Why is this simplification required? |
It is not "required", but as with many simplifications, it's less likely to make a mistake (e.g. not returning the buffer), is less code to maintain and easier to read an understand. In addition, not needing the try-finally potentially enables more inlining / slightly less work needing to be done. Then the move of the starttime property means that only the continuation that needs this property will pay for setting the value, not all others as well that never used the value. And last but not least, the sealing of internal types is another small performance related change, that a Analyzer for the newer frameworks would flag. |
I'm just curious. Do you have any traces or benchmarks that show this?
This is unrelated to |
Try-catch blocking inlining can be seen here or here. Whether or not it actually improves things based on this changes is a bit harder to prove, which is why I didn't even try. Improvements will be minimal compared to the time the other things take and to my knowledge, there's no isolated benchmark in this area (CommandAssembler until Dispatcher) |
Thanks @bollhals, I will review this today or tomorrow. |
4807307
to
6acbf12
Compare
@bollhals thanks, this is a nice improvement. |
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 will merge once CI passes. Thanks!
Proposed Changes
Simplifies the handling of the ReturnBuffers by calling it at one central place, instead of many places.
-> This gets rid of the try-finally(return_buffer) pattern, as it is no longer needed. If there is an exception, the buffer will not be returned, but no real harm is done. It is not an uncommon pattern.
In addition, this commit seals the Continuation types (in accordance to CA1852)
Types of Changes
Checklist
CONTRIBUTING.md
documentFurther Comments