-
Notifications
You must be signed in to change notification settings - Fork 211
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
Rotate02 #435
base: main
Are you sure you want to change the base?
Rotate02 #435
Conversation
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.
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.
if (pni_buffer_wrapped(buf)) | ||
pn_buffer_rotate(buf, buf->start); | ||
else | ||
memmove(buf->bytes, buf->bytes + buf->start, buf->size); |
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 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 {
...
}'''
There are 2 use cases for
|
Thanks for taking a look. I will try to rework this as suggested. |
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.