-
Notifications
You must be signed in to change notification settings - Fork 39
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
A performanсe when publishing many packets to the same topic #52
Comments
It seems that a pub struct PublishPacketRef<'a> {
fixed_header: FixedHeader,
topic_name: &'a TopicNameRef,
packet_identifier: Option<PacketIdentifier>,
payload: &'a [u8],
} And |
Hmmm perhaps split |
What about impl only Encodable for PublishPacketRef?
|
Yes, I have already tried both @Spoonbender and @YuriK75 's proposal locally, yesterday.
I haven't decided yet, maybe both of yours ideas should be adopted, which may lead to a huge API breaking chage. |
Yes, that is a simpler solution, but only be useful for this case. |
@zonyitoo maybe a |
|
It should be ok to remove the |
- splits Packet into EncodablePacket and DecodablePacket - removes default payload() and payload_ref() methods - fixes encoded_length() implementations for all packets - add PublishPacketRef for performance optimization
Please check if this commit works for you. |
- splits Packet into EncodablePacket and DecodablePacket - removes default payload() and payload_ref() methods - fixes encoded_length() implementations for all packets - add PublishPacketRef for performance optimization
- splits Packet into EncodablePacket and DecodablePacket - removes default payload() and payload_ref() methods - fixes encoded_length() implementations for all packets - add PublishPacketRef for performance optimization
Hmmm... so many changes ... I think my issue much less difficult to solve...
Yuri |
|
I forgot to say "thank you". You made a lot of work for me!
пт, 26 февр. 2021 г. в 04:11, ty <notifications@github.com>:
… TopicNameRef is not a new struct. But I think it is safe to remove
because nobody is actually using it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#52 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOLFLPHLT6T2YP3CCCFKHO3TA3YN3ANCNFSM4XOQPHTA>
.
|
I just double checked the design of It is ok to left it there, you can just pass |
- splits Packet into EncodablePacket and DecodablePacket - removes default payload() and payload_ref() methods - fixes encoded_length() implementations for all packets - add PublishPacketRef for performance optimization
As for me, PublishPacketRef should use &TopicName in topic_name field instead of &TopicNameRef. Can You change it? I think TopicNameRef can be everywhere replaced by &TopicName (& is the same thing as "Ref"). |
Lines 274 to 278 in e910579
Could you provide a code snippet about this? Is this design causing unfixable compile errors? Are there any uncomfortable use cases? |
Hi!
As I see, for publish a packet from client - I must:
When I need (and many others probaly too) to publish different (millions by day) payloads to the same (thousands) topics -
i can't reuse TopicName for doing 1-2 steps once and doing only 3-6 steps for every publish.
Also i can't store a packet for later reuse - it does not support payload replacing.
So this architecture breaks performance.
If You can add ability for using in packet shared ref to TopicName (and for payload may be too, but it
is not important) - it will be great!
Or add convenience fn which receives &TopicName, payload: &[u8], &mut Vec
and serializes 1st and 2nd arguments to 3rd...
Yuri
The text was updated successfully, but these errors were encountered: