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

Let user specify iterations without improvement #21

Merged

Conversation

Pr0methean
Copy link
Contributor

@Pr0methean Pr0methean commented Jun 24, 2023

This PR adds two enhancements for situations when small compression improvements are worth a lot of CPU time (including research purposes where a high chance of finding the absolute smallest possible file is desired).

  • It changes the maximum-iteration type to NonZeroU64 to allow more than 255 iterations.
  • Rather than or in addition to a maximum number of iterations, the user can specify that a block is finished once a certain number of iterations have failed to produce an improvement.

It also skips the unused stats randomization during the final iteration. Dead-code elimination could not have done this, because calling a PRNG mutates its state.

@Pr0methean Pr0methean force-pushed the iterations-without-improvement branch 5 times, most recently from 6729134 to cdf7851 Compare June 24, 2023 18:23
@Pr0methean Pr0methean force-pushed the iterations-without-improvement branch from cdf7851 to 11d6fce Compare June 24, 2023 18:29
Pr0methean added a commit to Pr0methean/oxipng that referenced this pull request Jun 24, 2023
Pr0methean added a commit to Pr0methean/oxipng that referenced this pull request Jun 24, 2023
Pr0methean added a commit to Pr0methean/oxipng that referenced this pull request Jun 24, 2023
Pr0methean added a commit to Pr0methean/oxipng that referenced this pull request Jun 24, 2023
Pr0methean added a commit to Pr0methean/oxipng that referenced this pull request Jun 24, 2023
@AlexTMjugador
Copy link
Member

Thank you a bunch for this PR, your changes look interesting. Before I give it a closer review, I'd like to know if you were able to prove any of the hypotheses you suggested in #17?

@Pr0methean
Copy link
Contributor Author

No, I haven't. I'll have a lot of experimenting to do in the future.

Pr0methean added a commit to Pr0methean/OcHd-RustBuild that referenced this pull request Jun 24, 2023
Pr0methean added a commit to Pr0methean/oxipng that referenced this pull request Jun 24, 2023
Copy link
Member

@AlexTMjugador AlexTMjugador left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish you the best of luck with your experiments!

These changes look good to me, at least until someone of us proves the hypotheses you proposed in the mentioned issue. Let's merge this.

@AlexTMjugador AlexTMjugador merged commit 95f49a0 into zopfli-rs:main Jun 26, 2023
@AlexTMjugador AlexTMjugador added the enhancement New feature or request label Jun 26, 2023
shssoichiro added a commit to shssoichiro/oxipng that referenced this pull request Jul 8, 2023
…later (#530)

* Add .whitesource configuration file

* Experimental: allow Zopfli to use any size BufWriter

* Allow user to specify the output buffer size as well

* Allow user to specify maximum block splits

* Reformat and fix warnings

* Use deflater on iCCP chunk as well

* Bug fix: need to implement Zlib format

* Make functions const when possible

* Switch to using zopfli::Options in prep for zopfli-rs/zopfli#21

* Switch to using zopfli::Options in prep for zopfli-rs/zopfli#21

* Cargo fmt

* Fix compilation

* Fix tests

* Fix more lints

* Fix more lints

* Fix compilation more

---------

Co-authored-by: mend-bolt-for-github[bot] <42819689+mend-bolt-for-github[bot]@users.noreply.github.com>
Co-authored-by: Chris Hennick <[email protected]>
Co-authored-by: Chris Hennick <[email protected]>
Pr0methean added a commit to Pr0methean/oxipng that referenced this pull request Dec 1, 2023
…later (shssoichiro#530)

* Add .whitesource configuration file

* Experimental: allow Zopfli to use any size BufWriter

* Allow user to specify the output buffer size as well

* Allow user to specify maximum block splits

* Reformat and fix warnings

* Use deflater on iCCP chunk as well

* Bug fix: need to implement Zlib format

* Make functions const when possible

* Switch to using zopfli::Options in prep for zopfli-rs/zopfli#21

* Switch to using zopfli::Options in prep for zopfli-rs/zopfli#21

* Cargo fmt

* Fix compilation

* Fix tests

* Fix more lints

* Fix more lints

* Fix compilation more

---------

Co-authored-by: mend-bolt-for-github[bot] <42819689+mend-bolt-for-github[bot]@users.noreply.github.com>
Co-authored-by: Chris Hennick <[email protected]>
Co-authored-by: Chris Hennick <[email protected]>
Pr0methean added a commit to Pr0methean/oxipng that referenced this pull request Dec 1, 2023
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

Successfully merging this pull request may close these issues.

2 participants