-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
zb: allow direct access to message properties without allocating #1158
Conversation
…eader Message::into_body
d453f4c
to
ae7c976
Compare
Assuming my benchmarks are accurate, using It appears that most of this is coming from a desire to:
While I understand that general users of your library may benefit from all of these features, Would you consider a version of I understand these wins seem like a small amount of time, but I'd like to reiterate that
Please let me know if I can help in any way. |
Thanks for checking. That's not as impressive as I would have thought. I guess that's the cost of dropping an Arc. Did you try the Cow trick we talked about? I was hoping you'd prioritise that because if Cloning is the bottleneck here, that should help a lot. |
That depends on what you mean. 😊 At least, not by putting all API under the Message. It'll also be an API break if we do it in a consistent way. Can you please first try what could be a low-hanging fruit: only cloning the reference to the signature?
I'm not what you mean here. |
Attempted this with similar results. To note though, it is better than the Using
|
That seems good then. Let's do that please.
Well, in general, yes. We especially need it (and many other types) to be If/when we target no_std, one path would be to make those constraints conditional. Also to keep in mind that atomics aren't strictly necessary for Send+Sync.
I'm pretty sure but in the end it's about cost to benefit ratio. With benchmarks we can see how much is the cost so to be able to tell if it's worth it to spend time working on it and (especially) to reduce the ergonomics of the API for it.
How would that work better than the Cow trick? We could actually use Cow for all fields, no? |
This was superseded by #1188. |
zbus
to directly access a reference to header properties without cloning the signature or thePrimaryHeader
.zbus::message::Body
type.This increases performance relative to taking the cloned primary header and signature.
atspi
, branch = "deserialize-properly" can be cloned andcargo bench
run to confirm these results.Performance improvement for atspi is in the 30-50% range; I'll attach my benchmarks here for reference.
zbus-5.x
branch of atspideserialize-properly
branch of atspiPlease let me know if there is a better way to implement this.
For example, an appropriate trait to use, or whether this is even something you want to support.
(Also, I know the commits/formatting might be wrong; that's why it's a draft)
Thanks for everything,
—Tait