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

Don't copy contiguous bytes on reception #343

Draft
wants to merge 1 commit into
base: rolling
Choose a base branch
from

Conversation

fuzzypixelz
Copy link
Contributor

This uses the slices iterator API of zenoh-c to avoid unecessarily copying bytes into an owned slice, if and only if the bytes is made up of exactly one slice.

@fuzzypixelz
Copy link
Contributor Author

fuzzypixelz commented Dec 16, 2024

The aim of this pull request is to fix high latency for relatively large topics (e.g. 1 MB tagus) in the single-process iRobot benchmark with --ipc off. Results were obtained using the Mont Blanc topology on an Ubuntu 24.04.1 LTS machine with an Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz.

dd82e84

node topic size_b mean_us min_us max_us
ponce tagus 1000000 3016 2512 5705
geneva tagus 1000000 3513 2997 6457
mandalay tagus 1000000 2678 2214 5233

eed223a

node topic size_b mean_us min_us max_us
ponce tagus 1000000 1651 1363 2252
geneva tagus 1000000 1875 1557 2563
mandalay tagus 1000000 1390 1151 1867

eed223a + 401016c

node topic size_b mean_us min_us max_us
ponce tagus 1000000 393 257 1301
geneva tagus 1000000 657 438 1701
mandalay tagus 1000000 108 68 650

This uses the slices iterator API of zenoh-c to avoid unecessarily
copying bytes into an owned slice, if and only if the bytes is made
up of exactly one slice.
@fuzzypixelz fuzzypixelz force-pushed the no-copy-contiguous-bytes branch from a4be550 to eed223a Compare December 16, 2024 17:49
@fuzzypixelz fuzzypixelz changed the title Don't copy contiguous bytes on reception. Don't copy contiguous bytes on reception Dec 16, 2024
@clalancette
Copy link
Collaborator

Thanks for opening the PR.

We are just in the process of converting to zenoh-cpp as our API in #327. I'm assuming a similar idea will work there, but until we merge that, I'm going to mark this as a draft PR, and we can revisit it once we've merged that in.

@clalancette clalancette marked this pull request as draft December 16, 2024 18:13
@fuzzypixelz
Copy link
Contributor Author

Thanks for opening the PR.

We are just in the process of converting to zenoh-cpp as our API in #327. I'm assuming a similar idea will work there, but until we merge that, I'm going to mark this as a draft PR, and we can revisit it once we've merged that in.

The bytes slice iterator API exists in zenoh-cpp, however there is no z_bytes_to_slice equivalent so we would need to manually allocate a buffer in that case or just use as_vector. We could coordinate potential changes to the zenoh-cpp API if necessary.

@clalancette
Copy link
Collaborator

All right, we've now merged in #327. Please rebase this and make any necessary changes to adapt to zenoh-cpp, and then we can do a full review of it.

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