-
Notifications
You must be signed in to change notification settings - Fork 85
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
Improve throughput performance (trigger local subscriber focus) #730
Conversation
PR missing one of the required labels: {'internal', 'enhancement', 'dependencies', 'new feature', 'documentation', 'breaking-change', 'bug'} |
Looks good, but I do not really like the idea of memsetting everything to 0, especially for dependent structs. In case we modify null-constructors for their fields, we risk to face some difficult to detect bugs. |
I understand the issue, but then maybe we should make a distinction between If we distinguish the two then, I believe the performance increase won't cause problems. |
8eea8b1
to
9c29166
Compare
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.
Small note, others LGTM
src/net/reply.c
Outdated
@@ -49,13 +40,13 @@ void _z_reply_data_free(_z_reply_data_t **reply_data) { | |||
|
|||
z_result_t _z_reply_data_copy(_z_reply_data_t *dst, const _z_reply_data_t *src) { | |||
*dst = _z_reply_data_null(); | |||
dst->_tag = src->_tag; |
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.
What the reason of this change?
In case of error will be nice to avoid unnecessary dst changes.
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.
Yeah so "no data" value of tag is 3
and not 0
so I was trying to avoid a reply_data_init
function, but I guess that won't be avoided.
e06a1cb
to
29f592a
Compare
29f592a
to
22b67a0
Compare
…pse-zenoh#730) * feat: switch null functions to static inline * feat: switch check fct to static inline * feat: check if there are subs to trigger * feat: pass by ref with keyexpr alias and duplicate * feat: switch null fct to return {0} * feat: add local sub config token * feat: simplify slice_init / string_preallocate * feat: add expanded key case * feat: make _alias fct static inline * doc: fix typo * fix: add local subscriber token to config.h * doc: add warning on null functions * feat: add reply_data_init function
There is a small performance dip in non-fragment peer throughput compared with 0.11. Profiling helped identify a much longer time spent in
trigger_local_subscriber
and this PR aims to fix this.Static inline functions:
Functions that should have been inlined by the compiler (like
z_sample_null
) weren't. This is solved by explicitly setting all the_null
,_check
and_alias
functions tostatic inline
.Null functions:
A lot of time was spent initializing types to 0 compared to just using
memset(0)
, switching all the_null
functions to a{0}
initialization closed this gap and is less prone to error.Slice init / string preallocate:
This functions had many superfluous checks / init. They got simplified.
get_expanded_key_by_key:
Added a shorter path for already expanded keys.
trigger_local_subcriber:
Added a shorter path when there is 0 subscribers to trigger.
Added a config token,
off
by default, to execute this function.The fastest code is the one we don't execute