Skip to content

Avoid extra copy for serialized SHM chunks#551

Open
StanByriukov02 wants to merge 1 commit intoros2:rollingfrom
StanByriukov02:perf/shm-serialized-zerocopy-view
Open

Avoid extra copy for serialized SHM chunks#551
StanByriukov02 wants to merge 1 commit intoros2:rollingfrom
StanByriukov02:perf/shm-serialized-zerocopy-view

Conversation

@StanByriukov02
Copy link

When running with iceoryx shared memory enabled, we can receive a chunk that already contains serialized bytes, but we still copy that chunk into a heap buffer before deserializing/forwarding it.

This change avoids that extra copy by keeping a read-only view into the received SHM chunk (only when size is 4-byte aligned, otherwise it falls back to the existing padded-copy path). The rest of the serdata ops are switched to read from a generic read-only pointer so both owned buffers and external views work.

If you want a quick sanity check without profiling tools, set RMW_CYCLONEDDS_SHM_RECEIPTS=1 and the process will print one line at exit showing how many serialized SHM bytes were handled via view vs copied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants