Skip to content

Commit 209e7c2

Browse files
committed
Phase 13.14.GB: prange + bincount optimization
Step 2: np.bincount replaces Python loop (2.3s → 0.013s) Step 3: nb.prange(n_bins) parallelizes over bins (6s → expected <0.5s) No race condition — each bin writes to its own output row.
1 parent b4a9dea commit 209e7c2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

UTILS/dfextensions/groupby_regression/groupby_regression_sliding_window.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4154,7 +4154,7 @@ def _get_numba_agg_kernel():
41544154
"""Compile and return numba-accelerated window accumulation kernel."""
41554155
import numba as nb
41564156

4157-
@nb.njit(cache=True)
4157+
@nb.njit(parallel=True, cache=True)
41584158
def _accumulate_numba(
41594159
bin_coords, # (B, D) int64
41604160
neighbor_offsets, # (W, D) int64
@@ -4177,7 +4177,7 @@ def _accumulate_numba(
41774177
n_cols = sum_x.shape[1]
41784178
n_dims = bin_coords.shape[1]
41794179

4180-
for bi in range(n_bins):
4180+
for bi in nb.prange(n_bins):
41814181
for ni in range(n_offsets):
41824182
valid = True
41834183
flat_idx = np.int64(0)

0 commit comments

Comments
 (0)