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 ImageFactory and Buffer to Options #29

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

tgrigsby-sc
Copy link

Added an ImagePool and a Buffer as encoder options for improved encoding efficiency:

BenchmarkDecodePooled
BenchmarkDecodePooled-10      	  355448	      3650 ns/op	     581 B/op	       6 allocs/op
BenchmarkDecodeUnPooled
BenchmarkDecodeUnPooled-10    	   99817	     11573 ns/op	   66210 B/op	       8 allocs/op

The ImagePool will be used in the decode process to provide an image of the right dimensions if one already exists, which, once you're done with image, can be put back into the pool. Similarly, passing in the correct size of buffer will prevent multiple mem reallocs while writing.

See the benchmark test for details about usage.

lyoneel pushed a commit to lyoneel/go-webp that referenced this pull request Jul 7, 2024
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.

1 participant