Skip to content

Multithreading is not used for IDCT if the rayon feature is enabled #245

@Shnatsel

Description

@Shnatsel

hyperfine shows the image decoding being significantly faster with the rayon feature disabled:

Benchmark 1: jpeg-bench/target/release/jpeg-bench "some-large-jpeg.jpg"
  Time (mean ± σ):     705.5 ms ±  22.7 ms    [User: 830.4 ms, System: 151.0 ms]
  Range (min … max):   680.5 ms … 742.2 ms    10 runs
 
Benchmark 2: jpeg-bench-parallel/target/release/jpeg-bench-parallel "some-large-jpeg.jpg"
  Time (mean ± σ):     867.2 ms ±  11.1 ms    [User: 906.7 ms, System: 120.5 ms]
  Range (min … max):   854.6 ms … 888.7 ms    10 runs
 
Summary
  'jpeg-bench/target/release/jpeg-bench "some-large-jpeg.jpg"' ran
    1.23 ± 0.04 times faster than 'jpeg-bench-parallel/target/release/jpeg-bench-parallel "some-large-jpeg.jpg"'

Looking at the profile, it seems that the additional threads for IDCT are spawned only when the rayon feature is disabled (profile). When it is enabled, the IDCT is happening on the main thread (profile).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions