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

Option to limit number of iterations by CPU time [patch] #26

Open
GoogleCodeExporter opened this issue Mar 9, 2015 · 4 comments
Open

Comments

@GoogleCodeExporter
Copy link

I've added --timelimit option to zopflipng that stops iteration after the given 
number of seconds has elapsed, as measured by clock() function that's supposed 
to measure CPU time used.

This allows placing hard upper limit on how long optimization will take, e.g. 
when server needs to respond with optimized image on time or when impatient 
user is waiting for large image to optimize.

The time limit has the same inaccuracy as number of iterations: 
ZopfliLZ77Optimal() may be called several times (e.g. when strategy==3), 
multiplying actual number of iterations done, and so time. I did not try to 
compensate for that.

Original issue reported on code.google.com by pornel...@gmail.com on 16 Jul 2013 at 2:59

Attachments:

@GoogleCodeExporter
Copy link
Author

I've missed the fact that ZopfliLZ77Optimal() is called for each block, so the 
time limit is per block, which isn't very useful when blocks are split first.

Original comment by pornel...@gmail.com on 16 Jul 2013 at 5:05

@GoogleCodeExporter
Copy link
Author

Updated patch with per-block time limit

Original comment by pornel...@gmail.com on 16 Jul 2013 at 6:06

Attachments:

@GoogleCodeExporter
Copy link
Author

Sorry for the late reply. Something similar to this is actually planned, so 
this patch is useful, thank you.

Original comment by l...@google.com on 16 Aug 2013 at 8:40

@kornelski
Copy link
Contributor

PR #52

kornelski pushed a commit to ImageOptim/zopfli that referenced this issue Dec 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants