Skip to content

perf: select profitable compiled distance views - #108

Merged
isty2e merged 1 commit into
mainfrom
perf/scalar-leaf-geometry
Jul 28, 2026
Merged

isty2e merged 1 commit into
mainfrom
perf/scalar-leaf-geometry

Conversation

@isty2e

@isty2e isty2e commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • record whether a compiled geometry plan can amortize candidate-structure traversal
  • use encoded distance views for array, tuple, and record spaces while keeping scalar and permutation spaces on their lower-overhead validated paths
  • lock the dispatch boundary with focused tests and update the changelog

Why

Encoded snapshots avoid repeated composite traversal, but they add projection and alignment work when the existing geometry is already direct. In a 30-repeat rotating comparison, the selected path reduced the continuous workload from 129.50 to 113.88 us/eval relative to forcing scalar encoding. The structured array workload remained faster with encoding enabled, at 222.03 versus 241.25 us/eval.

An additional shape sweep found the encoded permutation path 14-16% slower at sizes 2 and 8, while singleton array, tuple, and record candidates still benefited. Candidate, result, and state digests matched across every comparison.

Validation

  • uv run --extra test ruff check pyproject.toml src tests .github/scripts
  • uv run --extra test ruff format --check pyproject.toml src tests .github/scripts
  • uv run --extra test basedpyright src tests .github/scripts
  • zuban check on all changed Python files
  • uv run --extra test pytest tests -q (1607 passed)
  • uv run --extra docs mkdocs build --strict

@isty2e
isty2e merged commit 586e1d1 into main Jul 28, 2026
8 checks passed
@isty2e
isty2e deleted the perf/scalar-leaf-geometry branch July 28, 2026 03:09
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