Open
Conversation
astitcher
reviewed
Oct 29, 2024
Member
astitcher
left a comment
There was a problem hiding this comment.
On the whole I really dislike this change: it complicates the code in a way that makes it harder to understand and doesn't introduce any abstractions to ease comprehension in any way.
I think we should only introduce this change if it gives us an observable performance improvement in real use cases.
Comment on lines
+239
to
+242
| if (pni_buffer_wrapped(buf)) | ||
| pn_buffer_rotate(buf, buf->start); | ||
| else | ||
| memmove(buf->bytes, buf->bytes + buf->start, buf->size); |
Member
There was a problem hiding this comment.
I think this logic is actually part of the _rotate function and should be there.
Also our code formatting has the braces explicitly present for this format of if:
if (...) {
...
} else {
...
}'''
Member
|
There are 2 use cases for
|
Contributor
Author
|
Thanks for taking a look. I will try to rework this as suggested. |
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.
the first commit does fewer buffer defrag/rotates in the case of outgoing deliveries.
the second takes advantage of code of first to promote more fairness in scheduling
third makes many calls to buffer defrag more performant. The first commit ensures that an outgoing delivery is never wrapped, so this optimization always applies. The special case of cj-sender runs > 10x faster, but streaming messages should in aggregate enjoy a performance boost or reduced cpu load.