Repository navigation
Commit d71fba2
Use cached hit box bounds in the spatial hash (#2900)
SpatialHash._get_cell_bounds() scanned the hit box's adjusted points
itself. It now reads HitBox.get_adjusted_bounds(), which caches the
bounds until the points change and shares them with collision checks.
For sprites that haven't moved since their bounds were last needed,
querying is ~40% faster and add + remove ~33% faster. Moving sprites
are unchanged, since their points are recalculated either way.
Co-authored-by: Paul V Craven <paul.craven@optimizley.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent a3a9eb2 commit d71fba2
2 files changed
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
118 | 117 | | |
119 | 118 | | |
120 | 119 | | |
| |||
0 commit comments