Summary
Patch release focused on Compose/applied-config overhead, uint8 posterize fast paths, corner illumination gradient generation, and salt-and-pepper sparsity routing. No new transforms and no intended output changes for existing pipelines beyond numerical parity with prior implementations where noted.
Microbenchmarks during development (local timeit, macOS arm64, Python 3.10; best-of repeated runs) showed roughly:
-
~4× faster scalar Posterize (
uint8,1024×1024RGB) vs the priorsz_lutscalar path; ~2× for per-channelbits=[…]on RGB (#250). -
~1.6–3.2× faster corner illumination gradient build vs
cv2.distanceTransform(DIST_L2/DIST_MASK_PRECISE), depending on spatial size (1024²vs512²) (#250). -
~1.6× faster SaltAndPepper apply for a fixed
~12%pixel-noise mask on1024×1024RGB when the sparse threshold moves from0.08→0.16(same masks; measures path selection, not RNG) (#250). -
~19× lower overhead for hot
get_transform_init_args_names()after the per-class cache vs forcing a full MRO/inspect.signaturewalk each call (5000× loop on HorizontalFlip; realComposewins are smaller but scale with pipeline size) (#250). -
Compose/ transform metadata: cacheget_transform_init_args_names()per transform class to avoid repeatedinspect.signature()work during applied-config construction (#250). -
Posterize (
uint8): scalar and per-channel paths use bitwise masking instead of LUT/sz_lutfor the hot paths (#250). -
Illumination (
mode="corner"): corner multiplier map uses Euclidean distance math (+cv2.sqrt) instead ofcv2.distanceTransform; aligned with the previous field via regression tests (#250). -
SaltAndPepper: raised the internal sparse-noise threshold so the copy-assign path wins on a wider range of realistic multi-channel densities (microbench-driven) (#250).
-
Docs / tests: benchmark and maintenance guidance updates; added/extended tests for init-args caching, posterize (
uint8/float32paths), corner-gradient parity, and zero-intensity corner gradient (#250). -
Housekeeping: telemetry unit test hardening (#249); packaging version →
2.2.5(#251).
Breaking changes
None.
New features
None.
Bug fixes
None shipped as user-visible correctness fixes in this patchline (changes are performance-path refactors with parity coverage where the implementation swapped).
Performance
Methodology: local timeit microbenchmarks (macOS arm64, Python 3.10, OpenCV as shipped in the dev env). Ratios are best-of repeated runs; absolute ms varies by CPU/OS/build — treat numbers as order-of-magnitude guidance, not a SLA.
get_transform_init_args_names()cache: ~19× faster for 5000 repeated calls on a warm per-class cache vs clearing_transform_init_args_names_cacheand paying the full MRO/inspect.signaturewalk each time (HorizontalFlip). End-to-endCompose(...)construction benefits are usually smaller but add up with many transforms (#250).- Posterize (
uint8,1024×1024RGB): ~4.2× vs prior scalarsz_lutpath; per-channelbits=[3,4,5]~2.0× vs the prior per-channel LUT loop (#250). - Illumination corner gradient (
intensity=0.1, corner2): ~1.62× at1024×1024, ~3.18× at512×512vscv2.distanceTransform(DIST_L2,DIST_MASK_PRECISE) (#250). - SaltAndPepper
apply_salt_and_pepper(1024×1024RGB, fixed masks with ~12% noisy pixels): ~1.60× faster with sparse threshold0.16vs0.08(same masks; isolates the multi-channel sparse fast-path eligibility) (#250).
Misc
- Developer docs: performance decision notes updated in maintainer-facing guidance (bitwise vs LUT, OpenCV bitwise usage,
distanceTransformavoidance, dispatch overhead) (#250). - Functional API:
create_corner_illumination_gradientremains a low-level helper (now documented); Illumination corner mode is the primary user-facing entry (#250). - Packaging:
pyproject.toml/uv.lockversion →2.2.5(#251).
Commits
| Commit | PR | Description |
|---|---|---|
2ee8884 | #249 | test(telemetry): force settings telemetry on for send assertions; version metadata housekeeping (pyproject.toml, uv.lock) |
eb72777 | #250 | perf: cache transform init-arg names; Posterize bitwise paths; Illumination corner Euclidean gradient; SaltAndPepper sparse threshold; tests; perf docs |
c1902d5 | #251 | chore: bump version to 2.2.5 (pyproject.toml, uv.lock) |