-
Notifications
You must be signed in to change notification settings - Fork 138
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
[ADDED] Support padding when allocating buffer for incoming messages #624
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.
Thank you for this pull request! Since this is an addition, I would like you to update your PR to be against the dev
branch (instead of main
). Also, would you be able to add a test (see https://github.com/nats-io/nats.c#testing for instructions). If you can't that's ok, I can come up with one and validate that your changes are ok before merge, then will submit a PR myself to add testing.
* this option. | ||
* | ||
* To clear the custom message buffer padding, call this function with 0. | ||
* |
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 would like to add a note here that says that changing the option has no effect on existing NATS connections.
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.
Done
@kozlovic ok, I've updated PR against
|
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.
Thank you for adding the test, I appreciate it! I have posted a comment. If you think that it is ok to keep it this way (suits your use-case), then I will approve and merge.
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.
Thank you for your contribution!
@kozlovic thank you for such a turbo review and accepting the PR ) |
When json is used as messages' payload and simdjson library is used to parse them it is strictly desirable to have SIMDJSON_PADDING bytes in the end of payload buffer. Otherwise parsing can't be done in zero copy manner - simdjson will reallocate it and copy all the payload into a temporary buffer.
I would like to introduce a new NATS option which will provide ability to set such a custom padding in message delivery path.