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

Support for demand-driven write #39

Open
bademux opened this issue Jul 25, 2020 · 3 comments
Open

Support for demand-driven write #39

bademux opened this issue Jul 25, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@bademux
Copy link

bademux commented Jul 25, 2020

Hi,
Nice wrapper, thanks!
Looks like I need some help with understanding "[demand-driven feature]( https://github.com/libvips/libvips/wiki/Why-is-libvips-quick)".
As far as I understand libvips can process image without loading it to RAM fully.
For Jvips it is possible to pass MappedByteBuffer as input; But how about output?
Does it mean JVips doesn't support this feature or I missed the point of "demand-driven" and it applies only for reading.

Thanks.
B.

@warrenseine
Copy link
Contributor

Yes, from my understanding, JVips doesn't support it, but it would be a nice improvement.

@dbouron Can you confirm?

@warrenseine warrenseine added the question Further information is requested label Jul 27, 2020
@warrenseine warrenseine changed the title [Q] demand-driven feature Support for demand-driven write Jul 27, 2020
@dbouron
Copy link
Contributor

dbouron commented Jul 27, 2020

Yes, we didn't implement it because when we measured cpu performance between mapped and byte array, the results were very similar.
Thus, we decided to keep a straightforward implementation for our app.
We didn't measure the impact on the memory, it would be a nice to have.
If we implement this feature, we must provide benchmark on the memory consumption.

@dbouron dbouron added enhancement New feature or request and removed question Further information is requested labels Jul 27, 2020
@bademux
Copy link
Author

bademux commented Jul 27, 2020

thanks!
btw,
here the small snippet how I test JVips
Read

		try (FileChannel ch = Files.newByteChannel(path, READ);
			 VipsImage image = new VipsImage(ch.map(READ_ONLY, 0, ch.size()), (int) ch.size())) {
			...
		}

Write

		try (FileChannel ch = Files.newByteChannel(path, WRITE)) {
			os.write(ByteBuffer.wrap(img.writeToArray(VipsImageFormat.JPG, true)));
		}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants