-
Notifications
You must be signed in to change notification settings - Fork 190
Intercept during routing #1864
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
base: main
Are you sure you want to change the base?
Intercept during routing #1864
Conversation
b565e89
to
1a64c5b
Compare
8835564
to
27a4761
Compare
27a4761
to
68ef1c7
Compare
Here are is a throughput performance comparison for 8-byte payloads with ACL enabled both on the publisher & the subscriber side between 9ad5304 (main) and 5fae354 (this pull request): We gain more than 300k messages per second for the median (as well as the mean) throughput on an Ubuntu Server 24.04 machine with a 12th Gen Intel(R) Core(TM) i5-1240P and 16GB of memory. |
.cloned() | ||
.collect::<Vec<Arc<FaceState>>>() | ||
.collect::<Vec<_>>() |
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.
maybe just .collect_vec() ?
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'd like to avoid depending on itertools
.
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.
They are still being used across zenoh crate (i.e. in low-pass and publisher builder)
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.
Right. But I don't see the value of saving a few characters at the cost of making it harder to remove itertools
down the line...
.cloned() | ||
.collect::<Vec<Arc<FaceState>>>() | ||
.collect::<Vec<_>>() |
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.
maybe just collect_vec() ?
} | ||
|
||
pub(crate) fn get_egress_cache( | ||
pub(crate) fn interceptor_cache( |
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.
get_interceptor_cache(...) is probably a better name
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.
In Rust the "get" prefix is often considered superfluous.
See https://rust-lang.github.io/api-guidelines/naming.html#getter-names-follow-rust-convention-c-getter.
match flow { | ||
InterceptorFlow::Egress => &self.eg_interceptors, | ||
InterceptorFlow::Ingress => &self.in_interceptors, | ||
} | ||
.as_ref() | ||
.map(|iceptors| iceptors.load()) | ||
.and_then(|iceptors| iceptors.is_empty().not().then_some(iceptors)) |
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 don't really like the .not()
and the fact that you don't use ?
. Why not:
match flow { | |
InterceptorFlow::Egress => &self.eg_interceptors, | |
InterceptorFlow::Ingress => &self.in_interceptors, | |
} | |
.as_ref() | |
.map(|iceptors| iceptors.load()) | |
.and_then(|iceptors| iceptors.is_empty().not().then_some(iceptors)) | |
let interceptors = match flow { | |
InterceptorFlow::Egress => &self.eg_interceptors, | |
InterceptorFlow::Ingress => &self.in_interceptors, | |
}; | |
Some(interceptors.as_ref()?.load()).filter(|i| !i.is_empty()) |
This also avoids computing the prefix if there is no iceptor.
Depends on #1828.