Skip to content

Allow IpcSharedMemory to support a take function that might be more efficient#433

Merged
sagudev merged 7 commits intoservo:mainfrom
Narfinger:vec-take
Jan 26, 2026
Merged

Allow IpcSharedMemory to support a take function that might be more efficient#433
sagudev merged 7 commits intoservo:mainfrom
Narfinger:vec-take

Conversation

@Narfinger
Copy link
Copy Markdown
Contributor

IpcSharedMemory currently only supports deref to get the element out of it. This leads to a lot of potential copies.
On some platforms these copies seem to be unavoidable but for inprocess we can actually take the already allocated vector.

For an example in servo this decreases the overall time of copying bytes from roughly 2.5ms from 117ms.

Signed-off-by: Narfinger Narfinger@users.noreply.github.com

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
@Narfinger Narfinger marked this pull request as ready for review January 8, 2026 11:59
Copy link
Copy Markdown
Contributor

@glyn glyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance of adding a test(s)?

Also, I'd like to understand the context better. What are the non-development usecases for single process Servo?

@Narfinger
Copy link
Copy Markdown
Contributor Author

Yes I can try to add a test.
Single process servo is used on small embedders. Some of them don't want to spend the resources on different processes, some of them make spawning different processes very difficult.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@glyn glyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and thanks for the test.

@sagudev sagudev added this pull request to the merge queue Jan 26, 2026
Merged via the queue into servo:main with commit d4f1e66 Jan 26, 2026
25 checks passed
@Narfinger Narfinger deleted the vec-take branch January 26, 2026 09:43
@glyn
Copy link
Copy Markdown
Contributor

glyn commented Jan 26, 2026

IpcSharedMemory currently only supports deref to get the element out of it. This leads to a lot of potential copies. On some platforms these copies seem to be unavoidable but for inprocess we can actually take the already allocated vector.

For an example in servo this decreases the overall time of copying bytes from roughly 2.5ms from 117ms.

How many bytes were copied? Presumably the time reduced from 117ms to 2.5ms?

@Narfinger
Copy link
Copy Markdown
Contributor Author

I don't have the report anymore and with the changes it would be a bit difficult to get the numbers again.
But the above was total time spend on the copying the bytes for this specific function over a run on servo for inprocess mode.

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.

3 participants