Commit 33ee8a1
perf: vectorize is_regular_1d for ndarray inputs
Per-element Python iteration over a 100K-element int64 array dominated
create_array runtime on the (10**8,) chunks=(1000,) regression case
(~6 ms in is_regular_nd, downstream of ChunksTuple normalization).
Dispatch on np.ndarray and use a single vectorized comparison instead.
End-to-end create_array on the regression case: ~7.9 ms -> ~0.6 ms.
Promote numpy to a runtime import (was TYPE_CHECKING-only) for the
isinstance dispatch.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 12a325a commit 33ee8a1
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | | - | |
43 | | - | |
44 | 43 | | |
45 | 44 | | |
46 | 45 | | |
| |||
385 | 384 | | |
386 | 385 | | |
387 | 386 | | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
388 | 390 | | |
389 | 391 | | |
390 | 392 | | |
| |||
0 commit comments