Commit graph

141 commits

Author SHA1 Message Date
Ingvar Stepanyan
bb332fa6d7
Don't override global rayon pool (#211)
Rayon uses a singleton global pool.

By default it's set to a regular spawn handler with number of logical CPU cores, but it can be overridden by Rust applications to customize number of threads, spawn handlers, exit handlers and other options.

Such customization should be usually done at the app level, because if a single library initialises the global pool, then Rayon will prevent any further overrides and they will error out. This can cause conflicts between libraries or library and user code and make them impossible to use together.

Hence, I've removed the `threads` option from the `Options` struct and instead moved initialisation to the CLI part of the codebase (main.rs).

Users of the library that didn't depend on custom `threads` number can keep using it as before - they'll still get same number of threads as number of logical CPU cores, while users who need fine-tuning, can do that by customizing rayon pool themselves at the top level of the app.

Note: another alternative to keep the option could've been to use `ThreadPoolBuilder::build` + `ThreadPool::install` to use a local pool just within OxiPNG, but that would ignore any customizations made by users in top-level pool and would prevent usage on targets that require custom spawn handlers like WebAssembly. As such, I've decided to avoid it.

Co-authored-by: Josh Holmer <jholmer.in@gmail.com>
2020-04-17 04:49:40 -04:00
dependabot-preview[bot]
11a7b68c4f Bump num_cpus from 1.12.0 to 1.13.0
Bumps [num_cpus](https://github.com/seanmonstar/num_cpus) from 1.12.0 to 1.13.0.
- [Release notes](https://github.com/seanmonstar/num_cpus/releases)
- [Changelog](https://github.com/seanmonstar/num_cpus/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/num_cpus/compare/v1.12.0...v1.13.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-16 10:54:52 +00:00
Ingvar Stepanyan
878bbedb37
Improve performance consistency (#202)
* Improve performance consistency

Switch from HashMap / HashSet to IndexMap / IndexSet for consistent iteration order of various options and, as a result, more predictable performance.
2020-03-31 21:54:05 -04:00
Ingvar Stepanyan
121558bf5c
Add libdeflater as an option (#203)
libdeflater is a Rust wrapper around
[libdeflate](https://github.com/ebiggers/libdeflate) - an alternative
heavily optimised library for deflate/zlib/gzip compression and
decompression that is intended for situations where upper bounds of the
output are well-known.

In my benchmarks on test files in the repo it has shown to be usually
both slightly faster and providing better compressed output than
cloudflare-zlib, but in some cases showing the opposite, so rather
than swapping defaults, it's currently provided as another option,
similarly to zopfli.

Since it's not strictly better in all cases, I'm not providing median
numbers, but you can check distribution histograms for time and size
differences here (all using `oxipng -o 6 -t 6 -P`):
https://docs.google.com/spreadsheets/d/1WOKgeYZBhLkQvMGAC36snN4azilElzOFhx63RJu0EZY/edit?usp=sharing
2020-03-31 20:24:57 -04:00
dependabot-preview[bot]
6593a5f6fe Bump itertools from 0.8.2 to 0.9.0
Bumps [itertools](https://github.com/bluss/rust-itertools) from 0.8.2 to 0.9.0.
- [Release notes](https://github.com/bluss/rust-itertools/releases)
- [Changelog](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bluss/rust-itertools/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-19 04:03:14 +00:00
Josh Holmer
b9dc9e72bb Update image crate to 0.23 2020-03-02 01:44:53 -05:00
Josh Holmer
139d29cc9b Version 2.3.0 2019-10-07 23:34:23 -04:00
Kornel
239ca81db7 Update dependencies (#186)
* Update dependencies

* Bump Rust to 1.34
2019-08-04 12:12:08 -04:00
Josh Holmer
9408a50b1b Version 2.2.2 2019-07-03 19:21:21 -04:00
Josh Holmer
b2364d2398 Update dependencies 2019-07-03 19:14:42 -04:00
Hugo Locurcio
5b5aeaa683 Enable link-time optimization for release builds (#177)
This creates faster and smaller binaries, at the cost of longer
build times.
2019-06-26 09:09:26 -04:00
Josh Holmer
3809421de7 Use image 0.21.2 with bugfixes from crates.io 2019-06-19 15:21:41 -04:00
Josh Holmer
9c6190c1ff Version 2.2.1 2019-03-26 14:19:34 -04:00
Josh Holmer
7bd7c0cfc9 Bump image crate to handle large images
Closes #167 and #168
2019-03-26 14:14:01 -04:00
Josh Holmer
bd6e7dbbb1 Version 2.2.0 2019-02-01 17:30:16 -05:00
Josh Holmer
d86bc80f43 Prepare for next release 2019-02-01 17:27:03 -05:00
Josh Holmer
c92b03d908 Remove unused features 2019-02-01 16:42:00 -05:00
Kornel
9af874d21b Make reductions return a new uncompressed image (#158)
* Fix verbose message

* No cloning when restoring original data

* Make reductions return a new uncompressed image

Partially fixes #145

* Async reduction evaluator

* Assert

* Faster bit depth check

* Also try 4-bit depth for small-depth images

* Skip test when using miniz

* Ensure palette is trimmed after depth reduction

Fixes #159

* Fudge factor for reductions to prefer better reductions even if gzip estimation says otherwise
2019-01-27 03:22:49 -05:00
Josh Holmer
d91fc890cd 2.1.8 2018-12-02 00:14:43 -05:00
Josh Holmer
565d08ed72 Version 2.1.7 2018-11-27 22:34:58 -05:00
Kornel
ff7a9547c3 Nicer wrapper for cfzlib (#149) 2018-11-25 03:29:30 -05:00
Kornel
686adcdebd Optimize RGB/A to palette conversion (#148) 2018-11-22 21:52:02 -05:00
Josh Holmer
d82406a959 Version 2.1.6 2018-11-17 18:02:16 -05:00
Joshua Holmer
88035ccbae Version 2.1.5 2018-10-11 08:41:11 -04:00
Josh Holmer
903f962f29 Version 2.1.4 2018-09-28 21:05:58 -04:00
Josh Holmer
a4e0a34357 Bump version to 2.1.3 2018-09-16 23:21:51 -04:00
Josh Holmer
edd4966cea
Fix compilation error on i686 due to cfzlib incompat (#138)
Closes #137
2018-09-16 14:43:08 -04:00
Josh Holmer
df07d10a5c Version 2.1.2 2018-08-11 23:35:57 -04:00
Josh Holmer
7895e42687 Version 2.1.1 2018-08-11 20:34:04 -04:00
Josh Holmer
4ea310fa68 Version 2.1.0 2018-08-04 23:28:14 -04:00
Josh Holmer
3b42f42491 Revert "Revert "Make cfzlib the default on platforms that support it""
This reverts commit ff0e3df948.
2018-08-04 23:08:30 -04:00
Josh Holmer
2241fd2c3b Version 2.0.2 2018-07-27 23:07:05 -04:00
Josh Holmer
b948264c32 Version 2.0.1 2018-07-21 00:40:48 -04:00
Josh Holmer
ff0e3df948 Revert "Make cfzlib the default on platforms that support it"
This reverts commit 2702145f3f.

cfzlib seems to have a MASSIVE memory leak in it. Trying to use it
when processing many files at once will cause your system to run out
of memory.

Closes #125
2018-07-21 00:37:57 -04:00
Josh Holmer
d110949d2a Version 2.0.0 2018-07-20 19:19:20 -04:00
Josh Holmer
2702145f3f Make cfzlib the default on platforms that support it
Raises the minimum Rust version to 1.27.0
2018-07-20 19:03:17 -04:00
Josh Holmer
b235e5601f Remove deprecated clippy plugin, use rustup clippy now 2018-07-20 18:50:27 -04:00
myfreeweb
ae65e4be8d Make Rayon an optional dependency (#112)
On WebAssembly, Rayon does not work (thread pool fails to initialize since threads are stubbed out).
2018-07-06 10:50:36 -04:00
Kornel
2d303f5dc2 Avoid double glob processing on unix (#111) 2018-07-06 08:11:42 -04:00
magicgoose
5570a24781 allow listing more than 2 filters (#105)
Closes #101
2018-06-06 21:10:20 -04:00
Kornel
e472c82876 Option to use Cloudflare's zlib for compression (#103)
Behind the nightly feature flag for now--stable ASM is coming in Rust 1.27
2018-06-04 15:39:51 -04:00
Kornel Lesiński
a846f9da53 Disallow building of broken binary 2018-05-31 15:18:04 +01:00
Josh Holmer
cff34358d7 Bump dependencies for 1.0.4 2018-05-01 20:52:32 -04:00
Josh Holmer
8a2bdcd133 Version 1.0.3 2018-04-03 19:03:15 -04:00
Josh Holmer
4e6188919f Bump dependencies 2018-04-03 18:56:43 -04:00
Josh Holmer
d7369707ba Fix a change that breaks itertools with newer versions of Rust nightly 2018-03-04 23:47:06 -05:00
Josh Holmer
88636d269d Actually these need to be under the badges section 2018-02-23 21:45:01 -05:00
Josh Holmer
4a0445b663 Add a couple of new Cargo tags 2018-02-23 20:56:00 -05:00
Josh Holmer
10123daad2 Version 1.0.1 2018-02-21 18:36:56 -05:00
Josh Stone
6f123c6382 Update to rayon 1.0 2018-02-20 14:14:45 -08:00