-
Notifications
You must be signed in to change notification settings - Fork 168
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
feature/true-zero-copy-7 #1082
feature/true-zero-copy-7 #1082
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.
clang-tidy made some suggestions
class CPayloadWriter | ||
{ | ||
public: | ||
CPayloadWriter() = default; |
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'm not sure if itmake sense to explicitly define default contructors and assignment operator in an abstract base class as you cannot call them directly.
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 think you still need them. Especially the assignment / move ones, since you NEED the virtual desctructor. If you don't have the others, the objects will not be movable!
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 was talking about the contructors, not the destructor. In the end, the derived class is moveable as well as copyable by default even if the destructor of the abstract base class is marked as virtual. The compiler will anyways generate all default ctors and assigment operators if the user does not specify them on its own.
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.
This is false. This is why you have the rule of 5.
If you declare the destructor, copy assignment and copy constructor are defined, but move constructors / assigment ARE not. Thus your class will not be moveable.
Very interesting development! Two questions:
|
@chengguizi the zero-copy message transport feature will be part of the next 5.12 release. The message protocols google protobuf and capnproto will be supported as well, flatbuffers currently not. For these serialization formats the zero-copy feature would change the behavior that way that the message content is serialized in the opened memory file directly without creating an intermediate buffer. This new behavior may also have some overall performance drawbacks if your serialization call takes a long time and is so blocking the file for connected subscribers. But the good news is you can switch on/off this feature for every single publisher. And yes by combining it with multiple write buffers you may get rid of the serialization file blocking. |
Pretty much look forward, can't wait for 5.12 release! |
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
eCAL's current zero copy mode is realizing zero copy on the receiving side only. The sending (publishing) side still makes a single memory copy to provide a generic concept for all transport layers (zero copy and none zero copy capable ones).
What is the new behavior?
The new approach applies true zero copy for local publish/subscribe connections. It enables the direct modification of the memory file content without any additional copy action (zero copy).
The pictures shows two applications
ecal_sample_latency_snd -z
andecal_sample_latency_rec
running on Ubuntu 22.04, exchanging 32MB payloads in 3 µs.Does this introduce a breaking change?
New
CPublisher
API functions added using the neweCAL::payload
class.Sample Usage