Commit bcf9adf
Filter plain leaf values out of the traverse stack at push time (#190)
Every scalar leaf used to be pushed onto the traversal stack as a
(value, tracked) tuple, only to be popped, run through the Proxy
isinstance check and the type dispatch, and discarded. Filtering
plain-typed values (which can never be a proxy or a traversable
container) at push time skips all of that.
Measured on bench/test_traverse.py: test_traverse_matrix 374us -> 83us,
test_traverse_large_flat_list 134us -> 22us, test_traverse_mixed
38us -> 18us, test_traverse_shallow 14us -> 3us.
Claude-Session: https://claude.ai/code/session_01UyALuqgF1ZZ3Lj88FzwGVc
Co-authored-by: Claude <noreply@anthropic.com>1 parent 1889213 commit bcf9adf
1 file changed
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
222 | 225 | | |
223 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
224 | 231 | | |
225 | 232 | | |
226 | 233 | | |
| |||
0 commit comments