Skip to content

perf: coordinate reverse positions aggregation APIs - #1690

Open
samukweku wants to merge 3 commits into
devfrom
issue-100-pyjanitor-positions
Open

perf: coordinate reverse positions aggregation APIs#1690
samukweku wants to merge 3 commits into
devfrom
issue-100-pyjanitor-positions

Conversation

@samukweku

Copy link
Copy Markdown
Collaborator

Summary

Coordinate the pyjanitor calls for all five reverse positions aggregations. Remove the redundant length argument from the positions wrappers and dispatch only the remaining positions aggregations with that argument.

Related

Verification

  • Pre-commit checks passed for formatting, lint, and docstring validation
  • Python syntax checks passed
  • Rust-side tests and old-vs-compact benchmarks are included in the five corresponding janitor-rs PRs

Runtime tests and benchmark execution remain pending because the local macOS host lacks the configured Python 3.9 framework.

samukweku and others added 2 commits August 22, 2026 08:23
Remove a duplicate _sum_starts_ends definition, replace ~87 repeated
per-call dtype-dispatch dicts in _agg_functions.py/_compare.py/
_binary_search.py with one cached dispatcher (_rs_func), and swap
repeat_index calls for np.repeat, which benchmarks faster at every
scale tested and is more immediately readable.

Issue #1649 @samukweku

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V3KAbkp6JV96KYXNc6EJmN
@samukweku samukweku self-assigned this Aug 26, 2026
@samukweku

Copy link
Copy Markdown
Collaborator Author

Contract documentation is now included in this PR and its branch AGENTS.md.

  • Direct Rust reverse-match kernels reject an empty flattened matches tape; malformed tape shape is not silently accepted.
  • A batch with no candidates at all is valid at the Python level, so pyjanitor pre-filters that case and returns the normal typed empty result before dispatching to Rust.
  • Individual zero-width ranges remain valid when the overall tape is non-empty.
  • The comparison/producer layer owns the matches values-in-{0,1} invariant; the Rust boundary validates tape shape.
  • The compatibility length argument exists only for older janitor-rs wheels.

An ELI5 explanation is included in the Python module docstring and AGENTS.md.

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