Commit 872d6a4
committed
data: Skip the O(n) np.delete in index_handle_oob for numeric indices
index_handle_oob dropped out-of-bounds (None) entries with
np.delete(idx, where(idx == None)) on every 1-D array index. Only an
object array can hold those sentinels; a plain numeric index has none, so
the call was a wasted O(n) copy (plus an elementwise '== None'). Return
the index unchanged in that case. A 65536-point assignment drops from
~1.6 ms to ~0.17 ms; the object-array path (real OOB drops) is unchanged.1 parent ad8366a commit 872d6a4
1 file changed
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
127 | 131 | | |
128 | 132 | | |
129 | 133 | | |
| |||
0 commit comments