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

add_image encourages copies of image data #359

Closed
jrmuizel opened this issue Aug 19, 2016 · 3 comments
Closed

add_image encourages copies of image data #359

jrmuizel opened this issue Aug 19, 2016 · 3 comments

Comments

@jrmuizel
Copy link
Contributor

@jrmuizel jrmuizel commented Aug 19, 2016

add_image() currently takes a vec this means that if owners of the image data want to keep it around they have to make a copy. This is what currently happens with servo. It would be much better for add_image to take a reference to this data to avoid the copy.

@nical
Copy link
Collaborator

@nical nical commented Nov 25, 2016

Note that ImageData now stores an Arc<Vec<u8>> instead of a Vec<u8> which means servo does not need to copy the image buffer anymore (unless the api sender is in a different process in which case it's a more complicated story).

@kvark
Copy link
Member

@kvark kvark commented Nov 25, 2016

For IPC, Arc still implements serialization, but the whole vector will be transferred over regardless, so there is not much benefit.

@glennw
Copy link
Member

@glennw glennw commented Feb 7, 2017

We now have the external image API, which can be used to supply images with zero-copy overhead.

@glennw glennw closed this Feb 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.