Skip to content

Optimize vertical_sample performance#2937

Open
Isotr0py wants to merge 7 commits into
image-rs:mainfrom
Isotr0py:opt-vertical-sample
Open

Optimize vertical_sample performance#2937
Isotr0py wants to merge 7 commits into
image-rs:mainfrom
Isotr0py:opt-vertical-sample

Conversation

@Isotr0py
Copy link
Copy Markdown
Contributor

@Isotr0py Isotr0py commented May 4, 2026

  • Similar to Optimize horizontal_sample performance #2894 with cache introduction
  • But only enable pre-computed cache when memory budget is large enough, because the cache is inefficient in extreme case for vertical sample (low hit rate).

Benchmarks

resize 400x300 Nearest  time:   [2.1213 ms 2.1550 ms 2.1871 ms]
                        change: [-24.458% -22.829% -21.163%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  6 (6.00%) high mild

resize 400x300 Triangle time:   [6.9562 ms 7.0203 ms 7.0866 ms]
                        change: [-29.626% -28.783% -27.990%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
  9 (9.00%) high mild

resize 400x300 CatmullRom
                        time:   [9.7698 ms 9.8562 ms 9.9452 ms]
                        change: [-43.885% -43.137% -42.386%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
  2 (2.00%) high mild

resize 400x300 Gaussian time:   [12.528 ms 12.639 ms 12.754 ms]
                        change: [-49.790% -49.195% -48.586%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild

resize 400x300 Lanczos3 time:   [12.608 ms 12.724 ms 12.843 ms]
                        change: [-49.570% -48.980% -48.370%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
  2 (2.00%) high mild

large/resize 2000x2000 Nearest
                        time:   [63.963 ms 64.532 ms 64.927 ms]
                        change: [-10.545% -9.1141% -7.7965%] (p = 0.00 < 0.05)
                        Performance has improved.
large/resize 2000x2000 Triangle
                        time:   [72.503 ms 72.999 ms 73.669 ms]
                        change: [-16.895% -15.550% -14.281%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 10 measurements (10.00%)
  1 (10.00%) low mild
large/resize 2000x2000 CatmullRom
                        time:   [80.833 ms 81.329 ms 82.067 ms]
                        change: [-25.137% -24.118% -23.064%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 3 outliers among 10 measurements (30.00%)
  1 (10.00%) low mild
  2 (20.00%) high mild
Benchmarking large/resize 2000x2000 Gaussian: Warming up for 1.0000 s
Warning: Unable to complete 10 samples in 5.0s. You may wish to increase target time to 5.0s or enable flat sampling.
large/resize 2000x2000 Gaussian
                        time:   [87.334 ms 88.567 ms 89.422 ms]
                        change: [-29.560% -28.375% -27.306%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 10 measurements (10.00%)
  1 (10.00%) high mild
Benchmarking large/resize 2000x2000 Lanczos3: Warming up for 1.0000 s
Warning: Unable to complete 10 samples in 5.0s. You may wish to increase target time to 5.1s or enable flat sampling.
large/resize 2000x2000 Lanczos3
                        time:   [91.461 ms 92.507 ms 93.475 ms]
                        change: [-26.768% -25.409% -23.994%] (p = 0.00 < 0.05)
                        Performance has improved.

Signed-off-by: Isotr0py <2037008807@qq.com>
Signed-off-by: Isotr0py <2037008807@qq.com>
Signed-off-by: Isotr0py <2037008807@qq.com>
Signed-off-by: Isotr0py <2037008807@qq.com>
Signed-off-by: Isotr0py <2037008807@qq.com>
Signed-off-by: Isotr0py <2037008807@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant