Skip to content

ENH: Add algorithm dispatch for IdentifySample OOC optimization#1545

Open
joeykleingers wants to merge 1 commit intoBlueQuartzSoftware:developfrom
joeykleingers:worktree-identify-sample-optimizations
Open

ENH: Add algorithm dispatch for IdentifySample OOC optimization#1545
joeykleingers wants to merge 1 commit intoBlueQuartzSoftware:developfrom
joeykleingers:worktree-identify-sample-optimizations

Conversation

@joeykleingers
Copy link
Contributor

@joeykleingers joeykleingers commented Feb 24, 2026

Summary

  • Split IdentifySample into two runtime-dispatched algorithm implementations: BFS flood fill (in-core, 1 bit/voxel) and scanline CCL with union-find (OOC, chunk-sequential)
  • Add reusable AlgorithmDispatch.hpp utility (IsOutOfCore, AnyOutOfCore, DispatchAlgorithm) for other filters to adopt the same pattern
  • Add documentation (docs/AlgorithmDispatch.md) explaining when and how to use algorithm dispatch

Performance

Config Before After Speedup
In-core (200³) 0.23s 0.17s 1.4x
OOC (200³) 841s 1.9s 475x

Test plan

  • All 89 correctness assertions pass on both in-core and OOC configurations
  • Benchmark test passes on both configurations
  • OOC tests confirm ZarrStore usage via chunk shape output

🤖 Generated with Claude Code

@joeykleingers joeykleingers added the enhancement New feature or request label Feb 24, 2026
@joeykleingers joeykleingers force-pushed the worktree-identify-sample-optimizations branch from d801a0a to 1bda2d9 Compare February 24, 2026 18:43
Split IdentifySample into two algorithm implementations selected at
runtime based on whether arrays use out-of-core (chunked) storage:

- IdentifySampleBFS: BFS flood fill optimized for in-core data (1 bit/voxel)
- IdentifySampleCCL: Scanline CCL with union-find optimized for OOC data

Add reusable AlgorithmDispatch.hpp utility (IsOutOfCore, AnyOutOfCore,
DispatchAlgorithm) so other filters can adopt the same pattern.

In-core benchmark: 0.17s (was 0.23s, 1.4x faster)
OOC benchmark: 1.9s (was 841s, 475x faster)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@joeykleingers joeykleingers force-pushed the worktree-identify-sample-optimizations branch from 1bda2d9 to c88c7f6 Compare February 24, 2026 18:43
Copy link
Contributor

@imikejackson imikejackson left a comment

Choose a reason for hiding this comment

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

As we discussed, there needs to be a clear path to exercise both code paths even with out-of-core is not being built. This PR should not be merged until this is figured out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants