Skip to content

perf(vision): reuse morphology workspace - #40

Merged
rsasaki0109 merged 1 commit into
mainfrom
agent/morphology-workspace-reuse
Jul 15, 2026
Merged

rsasaki0109 merged 1 commit into
mainfrom
agent/morphology-workspace-reuse

Conversation

@rsasaki0109

Copy link
Copy Markdown
Owner

What changed

  • add RectMorphologyWorkspace and caller-owned *_into APIs for rectangular u8 morphology
  • retain full-image ping-pong planes and per-worker line buffers across calls
  • expose Python MorphologyWorkspace and out= with shape, contiguity, and overlap validation
  • benchmark allocated and reuse modes against OpenCV 4.13
  • update README, roadmap, GitHub Pages morphology guide, and dated performance receipt

Why

The accelerated rectangular engine still rebuilt scratch planes and worker buffers on every public call. Explicit workspace/output reuse removes recurring host allocation cost while preserving safe APIs, exact output, explicit ownership, and generic-shape fallbacks.

Impact

On the recorded 12-thread Windows host, caller-owned 511×511 opening is 3.25× faster than OpenCV at 1080p and 2.77× faster at 4K. OpenCV remains faster for 5×5 rectangles, which is documented as the current optimization boundary.

Validation

  • cargo test -p spatialrust-vision --features imgproc-morphology (14 passed)
  • focused post-edit morphology tests (12 passed)
  • cargo clippy -p spatialrust-vision --features imgproc-morphology -- -D warnings
  • Python binding suite passed with one skip
  • 980 randomized OpenCV parity cases
  • Criterion benchmark target compiles
  • rustdoc generation and staged diff checks pass

@rsasaki0109
rsasaki0109 marked this pull request as ready for review July 15, 2026 15:43
@rsasaki0109
rsasaki0109 merged commit 05ab151 into main Jul 15, 2026
86 of 92 checks passed
@rsasaki0109
rsasaki0109 deleted the agent/morphology-workspace-reuse branch July 15, 2026 15:47
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