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

Thumbor should process gifs in a faster way. #1539

Closed
maiagripp opened this issue Dec 21, 2022 · 9 comments
Closed

Thumbor should process gifs in a faster way. #1539

maiagripp opened this issue Dec 21, 2022 · 9 comments
Labels

Comments

@maiagripp
Copy link
Contributor

maiagripp commented Dec 21, 2022

Expected behaviour

Thumbor should process gifs in a faster way.

Actual behaviour

Thumbor is taking too long to process some gifs. So we run some tests using gifsicle (our actual process gifs lib) and pil to compare time processing on both.
image

Conclusion

We thought, although Gifsicle indeed had a better performance in flips, pil had better processing times in all the others. We don't think the flip filter is heavily used, so the trade off pays itself.

@maiagripp maiagripp assigned maiagripp and unassigned maiagripp Dec 22, 2022
@maiagripp
Copy link
Contributor Author

@scorphus @guilhermef @kkopachev thoughts about that?

@guilhermef
Copy link
Member

I agree with you @maiagripp, using Pil to process GIFs would definitely be an improvement.

@scorphus
Copy link
Member

scorphus commented Dec 26, 2022

I seem to be missing something. Usage of gifsicle is optional and pil (or whatever engine is configured) is used whenever USE_GIFSICLE_ENGINE is set to None:

or self.context.config.USE_GIFSICLE_ENGINE is None

Perhaps we should adapt that line and document the behavior.

@scorphus
Copy link
Member

Also, this might be a good opportunity to support the cover "filter" when gifsicle isn't enabled.

@maiagripp
Copy link
Contributor Author

Hey @scorphus,
indeed you are right.
But we ran some tests comparing how Thumbor process GIFs using PIL and the engine we made and still we got better results.
Here what we got:

Processing Time
Crop 
Thumbor                 | Engine
real	0m20.348s         real	0m13.656s

Flips
Thumbor                 | Engine
real	0m22.240s         real	0m11.058s
real	0m20.546s         real	0m12.156s

Resize
Thumbor                 | Engine
real	0m58.331s         real	0m17.397s


Cover
Thumbor                  | Engine
(doesn't work)             real	0m9.699s

Content-Length 
Thumbor                  | Engine
Content-Length: 97324349   Content-Length: 38657490

And the visual result is also better.
On the left side is Thumbor and on the right side is the engine
Visual Results Thumbor X Engine

@marcelometal
Copy link
Member

@maiagripp please, share your code changes =)

@maiagripp
Copy link
Contributor Author

Here it is:
Code Gist

Could you take a look and share your thoughts?
@marcelometal @scorphus @guilhermef

@github-actions
Copy link

github-actions bot commented Feb 5, 2023

This issue is stale because it has been open 30 days with no activity. Remove the stale label or add a comment, or this issue will be closed in 15 days. You can always re-open if you still feel this is still an issue. Tag @heynemann for more information.

@github-actions github-actions bot added the Stale label Feb 5, 2023
@github-actions
Copy link

This issue was closed because it has been stale for 15 days with no activity.

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

No branches or pull requests

4 participants