Repository navigation
Commit 0a9b654
perf: a vertex makes its coordinate with np.array, not np.r_
np.r_[coord] is a class that parses its index and cost 1.4 us, 88% of
creating a vertex. np.array(coord, ndmin=1) costs 0.16 us and gives the same
array for every coordinate checked (a list, a tuple, a scalar, a numpy array of
either type, a range, a 2-D list): same shape, type and values, and a copy.
Vertex(coord) 1.59 -> 0.35 us; add_vertex(coord) 3.12 -> 1.72 us, where 0.6.5
took 2.18 us.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>1 parent d41fd62 commit 0a9b654
2 files changed
Lines changed: 33 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4518 | 4518 | | |
4519 | 4519 | | |
4520 | 4520 | | |
4521 | | - | |
| 4521 | + | |
| 4522 | + | |
4522 | 4523 | | |
4523 | 4524 | | |
4524 | 4525 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
42 | 73 | | |
43 | 74 | | |
44 | 75 | | |
| |||
0 commit comments