Skip to content

Move small-sigma Gaussian blur return to a helper - #3092

Closed
fyrsta7 wants to merge 1 commit into
image-rs:mainfrom
fyrsta7:perf/gaussian-blur-small-sigma-helper
Closed

Move small-sigma Gaussian blur return to a helper#3092
fyrsta7 wants to merge 1 commit into
image-rs:mainfrom
fyrsta7:perf/gaussian-blur-small-sigma-helper

Conversation

@fyrsta7

@fyrsta7 fyrsta7 commented Aug 2, 2026

Copy link
Copy Markdown

Summary

This moves the small-sigma identity return used by GaussianBlurParameters::new_from_sigma into a cold helper, leaving the normal positive-sigma path as the straight-line path.

Why this can improve performance

The sigma <= 0.0 case returns an identity kernel and is not the normal blur construction path. Keeping that path in a cold helper lets the common Gaussian-kernel setup stay a little smaller and more direct.

Validation

  • git diff --check
  • cargo check

Benchmark

Current machine, release microbenchmark, 9 samples, median:

Benchmark Base This change Delta
1024 GaussianBlurParameters::new_from_sigma calls 5,228.287 ns 5,214.858 ns 0.26% faster

@fyrsta7

fyrsta7 commented Aug 2, 2026

Copy link
Copy Markdown
Author

Closing this draft because follow-up benchmarking did not show a large enough performance gain to justify this as an upstream performance PR.

@fyrsta7 fyrsta7 closed this Aug 2, 2026
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