Commit graph

12 commits

Author SHA1 Message Date
Ingvar Stepanyan
e38c759563
Switch to crossbeam-channel + rayon::spawn (#327)
* Switch to crossbeam-channel + rayon::spawn

* Remove thread_spawn for evaluation altogether

This allows to avoid a deadlock when there is only one Rayon thread, and doesn't sacrifice performance, since the caller of .get_result() had to always block on the iterator to be finished anyway, and all the messages are already sent from separate threads.

* Fix `verbose_mode` test

This one is easier to "fix", since we're in control of the rayon pool - just adding one extra thread to the default number to make sure we always can one root "spawn" call without stealing from the actual pool.
2020-11-11 12:01:13 -05:00
Ingvar Stepanyan
4fd9203800 Bring back RefCell
It was accidentally removed as part of #208.
Fixes #214.
2020-04-16 18:31:24 -04:00
Ingvar Stepanyan
9b8361171f Revert "Unbreak no-default-features"
This reverts commit 4ef92089d5.
2020-04-16 18:31:24 -04:00
Josh Holmer
4ef92089d5 Unbreak no-default-features
In order to avoid problems with mutable references,
the approach is to use the eval sender for non-parallel.
Computations will still be done synchronously
with the fake synchronous rayon module.
2020-04-15 13:26:28 -04:00
Ingvar Stepanyan
63e36ed43f
Simplify comparer (#208)
* Skip baselines earlier in the evaluator

We know that we'll throw them away anyway, so there is no point in even sending them to Sender and comparing them with others once we used them for the best candidate size.

* Simplify comparison logic
2020-04-14 17:09:52 -04:00
Kornel
681089f8c7
Remove the concept of size bias (#199)
Closes #198
2020-03-31 19:28:22 -04:00
Ingvar Stepanyan
659717cb1f Allow usage on wasm32-unknown-unknown target (#194)
* Avoid using time API when we don't need it

This avoids a syscall to the time API when the result is ignored later anyway.

This allows to use the library with default options on wasm32-unknown-unknown, where the unimplemented syscall would panic otherwise.

* eval_send doesn't need to be an Option

We can drop the value manually, thus avoiding unwrap on each access.

* Keep single `use rayon::prelude::*`

If either `rayon` is already imported, then `rayon::prelude::*` should always resolve.

* Extract comparator

* Fully enable non-parallel mode
2019-09-25 13:01:53 -04:00
Josh Holmer
d86bc80f43 Prepare for next release 2019-02-01 17:27:03 -05:00
Kornel
485a127cf6 Remove Mutex from evaluation loop (#163) 2019-02-01 17:03:25 -05:00
Kornel
dad6230cf1 Check timeout more often during compression (#160) 2019-02-01 16:30:47 -05:00
Kornel
33890cf0fd Fake Rayon (#162)
Dummy implementation of Rayon's traits to avoid `#[cfg()]` and duplicated non-parallel code.
2019-01-28 13:35:42 -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