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

chore: replace oxipng with crates.io version once it's published #1

Closed
wait-what opened this issue Jun 16, 2023 · 2 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@wait-what
Copy link
Member

wait-what commented Jun 16, 2023

src/encode Putting it inside a rayon par_iter makes it hang, presumably because it already uses rayon. Since oxipng is really, really slow, it's important to make it multithreaded.

Once fixed, also update docs/input-manifest.md

@wait-what wait-what added enhancement New feature or request help wanted Extra attention is needed labels Jun 16, 2023
@wait-what
Copy link
Member Author

wait-what commented Jun 18, 2023

Using this code as an example. My CPU has 12 threads. This works perfectly well with 11, but as soon as I uncomment 12, none of them finish, there is no CPU activity and the program just hangs. On an 8 thread CPU, it works with 7, but hangs with 8, etc.

use rayon::prelude::*;
use oxipng::{optimize_from_memory, Options, Deflaters};

fn main() {
    let buffer = include_bytes!("sample.png").as_slice();

    let options = Options {
        deflate: Deflaters::Libdeflater { compression: 12 },
        ..Default::default()
    };

    vec![
        1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
        // 12,
    ].par_iter().for_each(|x| {
        println!("Optimizing {x}");
        optimize_from_memory(&buffer, &options).unwrap();
        println!("Done {x}");
    });
}

@wait-what
Copy link
Member Author

Seems to be an upstream issue shssoichiro/oxipng#517

@wait-what wait-what changed the title Parallelise oxipng chore: bump oxipng version once deadlock fix is merged Jun 21, 2023
@wait-what wait-what added bug Something isn't working and removed help wanted Extra attention is needed enhancement New feature or request labels Jun 21, 2023
@wait-what wait-what added this to the Initial release milestone Jun 22, 2023
@wait-what wait-what changed the title chore: bump oxipng version once deadlock fix is merged chore: replace oxipng with crates.io version once it's published Jun 27, 2023
@wait-what wait-what removed this from the Initial release milestone Jul 1, 2023
@wait-what wait-what self-assigned this Jul 1, 2023
@wait-what wait-what added the wontfix This will not be worked on label Aug 17, 2023
@wait-what wait-what closed this as not planned Won't fix, can't repro, duplicate, stale Aug 17, 2023
@wait-what wait-what removed the wontfix This will not be worked on label Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

1 participant