From ffec56615d7e1170b13ecc16e54ccbb04d7731ae Mon Sep 17 00:00:00 2001 From: samukweku Date: Wed, 26 Aug 2026 09:34:28 +1000 Subject: [PATCH] perf: update min reverse starts-match boundary --- AGENTS.md | 11 +++++++++++ janitor/functions/_conditional_join/_agg_functions.py | 2 -- janitor/functions/_conditional_join/_get_join_aggs.py | 6 ++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 34a7f1921..fdbed46f8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -548,6 +548,17 @@ CLI. include MkDocs. The documentation task is available in the `docs` environment. **Recommendation**: Run `pixi run -e docs build-docs` to build documentation. +### [2026-08-26] Include performance evidence in optimization PRs and issues + +**Context**: Performance changes are coordinated with implementation changes +in janitor-rs. +**Learning**: Benchmark results are part of the performance change's review +record, not merely local investigation notes. +**Recommendation**: Every performance PR and its tracking issue must include a +properly formatted comparison with the old implementation, covering runtime +and memory for the agreed tiny, large, very-large, and super-large cases and +duplicate/unique label distributions. State benchmark limitations explicitly. + --- ## Version History diff --git a/janitor/functions/_conditional_join/_agg_functions.py b/janitor/functions/_conditional_join/_agg_functions.py index 96fa0b7a2..5687c6cee 100644 --- a/janitor/functions/_conditional_join/_agg_functions.py +++ b/janitor/functions/_conditional_join/_agg_functions.py @@ -1356,7 +1356,6 @@ def _min_rev_starts_matches( index: np.ndarray, matches: np.ndarray, booleans: np.ndarray, - length: int, ) -> tuple: """ Compute min @@ -1385,7 +1384,6 @@ def _min_rev_starts_matches( index=index, matches=matches, booleans=booleans, - length=length, ) diff --git a/janitor/functions/_conditional_join/_get_join_aggs.py b/janitor/functions/_conditional_join/_get_join_aggs.py index d757c6f41..c97b5487d 100644 --- a/janitor/functions/_conditional_join/_get_join_aggs.py +++ b/janitor/functions/_conditional_join/_get_join_aggs.py @@ -180,15 +180,17 @@ def _agg_join_left(df: pd.DataFrame, aggfunc: list, indices: dict) -> pd.DataFra booleans = pd.isna(arr) arr = _helpers._convert_array_to_numpy(array=arr) func = mapping[agg] - _index, out = func( + kwargs = dict( arr=arr, starts=indices["starts"], index=indices["right_index"], matches=indices["matches"], counts=indices["counts_array"], booleans=booleans, - length=indices["right_index"].size, ) + if agg != "min": + kwargs["length"] = indices["right_index"].size + _index, out = func(**kwargs) if agg in { "sum", "prod",