Skip to content
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

Use Zero-Copy receive in all IPC-Channel types and the posh IPC channel #1693

Closed
2 tasks
elfenpiff opened this issue Sep 29, 2022 · 7 comments · Fixed by #2173
Closed
2 tasks

Use Zero-Copy receive in all IPC-Channel types and the posh IPC channel #1693

elfenpiff opened this issue Sep 29, 2022 · 7 comments · Fixed by #2173
Labels
Milestone

Comments

@elfenpiff
Copy link
Contributor

elfenpiff commented Sep 29, 2022

Brief feature description

Instead of using an API with an additional copy like:

 cxx::expected<std::string, IpcChannelError> receive()

the user could provide a preallocated object like iox::vector or iox::string where the received message is directly written into to avoid the additional copy. Like

cxx::expected<IpcChannelError> receive(cxx::vector<BUFFER_SIZE>& buffer);

Tasks

  • add API for iox::string
  • add API for iox::vector
@elfenpiff elfenpiff added this to the Low prio milestone Sep 29, 2022
@elBoberido
Copy link
Member

elBoberido commented Nov 16, 2023

@lucabart97 once you are done with the string this would be the issue to integrate the iox::string into the UnixDomainSocket and the other IPC channels.

@lucabart97
Copy link
Contributor

What type of iox::vector? char? uint8_t?

@elBoberido
Copy link
Member

elBoberido commented Nov 17, 2023

@lucabart97 with C++17 there is another option with std::byte. I think std::byte* can easily be casted to an uint8_t* or char* and removes the ambiguity of being interpreted as a C string. It also gives the user a hint which API to use. If one wants chars, it is iox::string and if one wants raw bytes it is iox::vector.

@lucabart97
Copy link
Contributor

lucabart97 commented Jan 20, 2024

what is the next step? 👀
You want also the iox::vector or I could move to the next interface that need the iox::string to avoid dynamic memory creation at runtime #1693 ?

@elBoberido
Copy link
Member

No, the iox::vector can be done later. You can move to the next interface. I'm currently not quite sure which one it is but be aware, once you use the new UnixDomainSocket API, Windows will not work since it uses the NamedPipe as IpcChannel. You need to also implement the API for the NamedPipe and MessageQueue since they can be configured to be used as IpcChannel.

@lucabart97
Copy link
Contributor

I don't know if I could work on NamedPipe, I do not have currently enough space for Windows (damm docker).
if you approve I start with MessageQueue!

@elBoberido
Copy link
Member

@lucabart97 the nice thing is that you do not need Windows for NamedPipe. It is implemented via our shared memory building blocks and therefore runs perfectly fine on Linux, macOS and FreeBSD. You can choose whatever pleases you :)

elBoberido added a commit to elBoberido/iceoryx that referenced this issue Feb 4, 2024
… iox::string in MessageQueue"

This reverts commit 890848f.
elBoberido pushed a commit to elBoberido/iceoryx that referenced this issue Feb 4, 2024
…ring in MessageQueue

By default, the MessageQueue class relies on std::string objects
to send and receive data, as defined by its interface. However, this
approach can potentially lead to dynamic memory allocation when
handling larger data payloads that exceed the stack space
optimization (SSO) limit.

To address this issue, an alternative API has been introduced that
enables data transmission and reception using iox::string.
This approach allows for direct data manipulation within stack
memory, effectively eliminating the need for dynamic memory
allocation.

Signed-off-by: Luca Bartoli <[email protected]>
elBoberido added a commit to elBoberido/iceoryx that referenced this issue Feb 4, 2024
… iox::string in MessageQueue"

This reverts commit 890848f.
elBoberido pushed a commit to elBoberido/iceoryx that referenced this issue Feb 4, 2024
…ring in MessageQueue

By default, the MessageQueue class relies on std::string objects
to send and receive data, as defined by its interface. However, this
approach can potentially lead to dynamic memory allocation when
handling larger data payloads that exceed the stack space
optimization (SSO) limit.

To address this issue, an alternative API has been introduced that
enables data transmission and reception using iox::string.
This approach allows for direct data manipulation within stack
memory, effectively eliminating the need for dynamic memory
allocation.

Signed-off-by: Luca Bartoli <[email protected]>
lucabart97 added a commit to lucabart97/iceoryx that referenced this issue Feb 4, 2024
By default, the NamedPipe class relies on std::string objects to
send and receive data, as defined by its interface. However, this
approach can potentially lead to dynamic memory allocation when
handling larger data payloads that exceed the stack space
optimization (SSO) limit.

To address this issue, an alternative API has been introduced that
enables data transmission and reception using iox::string.
This approach allows for direct data manipulation within stack
memory, effectively eliminating the need for dynamic memory
allocation.

Signed-off-by: Luca Bartoli <[email protected]>
lucabart97 added a commit to lucabart97/iceoryx that referenced this issue Feb 4, 2024
By default, the NamedPipe class relies on std::string objects to
send and receive data, as defined by its interface. However, this
approach can potentially lead to dynamic memory allocation when
handling larger data payloads that exceed the stack space
optimization (SSO) limit.

To address this issue, an alternative API has been introduced that
enables data transmission and reception using iox::string.
This approach allows for direct data manipulation within stack
memory, effectively eliminating the need for dynamic memory
allocation.

Signed-off-by: Luca Bartoli <[email protected]>
elBoberido added a commit that referenced this issue Feb 4, 2024
elBoberido added a commit to elBoberido/iceoryx that referenced this issue Feb 5, 2024
… iox::string in MessageQueue"

This reverts commit 890848f.
elBoberido pushed a commit to elBoberido/iceoryx that referenced this issue Feb 5, 2024
…ring in MessageQueue

By default, the MessageQueue class relies on std::string objects
to send and receive data, as defined by its interface. However, this
approach can potentially lead to dynamic memory allocation when
handling larger data payloads that exceed the stack space
optimization (SSO) limit.

To address this issue, an alternative API has been introduced that
enables data transmission and reception using iox::string.
This approach allows for direct data manipulation within stack
memory, effectively eliminating the need for dynamic memory
allocation.

Signed-off-by: Luca Bartoli <[email protected]>
elBoberido added a commit to elBoberido/iceoryx that referenced this issue Feb 5, 2024
… iox::string in MessageQueue"

This reverts commit 890848f.
elBoberido pushed a commit to elBoberido/iceoryx that referenced this issue Feb 5, 2024
By default, the MessageQueue class relies on std::string objects
to send and receive data, as defined by its interface. However, this
approach can potentially lead to dynamic memory allocation when
handling larger data payloads that exceed the stack space
optimization (SSO) limit.

To address this issue, an alternative API has been introduced that
enables data transmission and reception using iox::string.
This approach allows for direct data manipulation within stack
memory, effectively eliminating the need for dynamic memory
allocation.

Signed-off-by: Luca Bartoli <[email protected]>
@github-project-automation github-project-automation bot moved this to Done in v4.0 Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants