Skip to content

Conversation

@sassman
Copy link
Owner

@sassman sassman commented Jan 13, 2026

Summary

  • Addresses partially [FEAT] get rid of imagemagick dependency #5
    • got rid of imagemagick on the post processing of frames
    • todo: the final gif composition still depends on imagemagick
  • Native rounded corners and shadow effects via x-native-imgops feature flag
  • Gaussian blur uses separable convolution: O(w×h×k²) → O(w×h×k×2), ~60x algorithmic speedup
  • Row-parallel processing with rayon's par_chunks_mut
  • 800×800 shadow: ~140ms → ~23ms (83% faster), 3x faster than ImageMagick

Benchmarks

cargo bench -p t-rec --features x-native-imgops --bench decors_benchmark -- --sample-size 10 --warm-up-time 1
# or: cargo b:run --features x-native-imgops

Test plan

  • cargo test --features x-native-imgops -p t-rec
  • Benchmark comparisons against ImageMagick baseline

Uses signed distance field for anti-aliased corner edges instead of
ImageMagick. Enable with: cargo build --features x-native-imgops
Gaussian blur is separable: a 2D convolution decomposes into two 1D
passes (horizontal then vertical), reducing O(w×h×k²) to O(w×h×k×2).
For σ=20 (kernel size 121), this alone is ~60x faster.

Each pass is parallelized over rows via rayon's par_chunks_mut since
row computations are independent.

Benchmarks on 800×800 images show ~83% improvement (~140ms → ~23ms),
now 3x faster than ImageMagick. Small images (100×100) see slight
overhead from thread pool setup.

Run benchmarks: cargo bench -p t-rec --features x-native-imgops \
  --bench decors_benchmark -- --sample-size 10 --warm-up-time 1

Or use the alias: cargo b:run --features x-native-imgops
(see .cargo/config.toml)
- decors_benchmark.rs: criterion benchmarks for corner/shadow effects
- profile_shadow.rs: example for CPU profiling with samply/perf
- .cargo/config.toml: b:run alias for quick benchmark runs
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

2 participants