Commit d7e2fb9
perf: optimize TreeSitterWalker cursor usage (#148)
* perf: optimize TreeSitterWalker cursor usage
Replace per-node cursor creation with single reusable cursor for tree traversal.
This eliminates repeated allocations and improves performance for large documents.
Changes:
- Create single TreeCursor in walk() method instead of per-node cursors
- Refactor walk_pre_order and walk_post_order to use cursor navigation
- Use goto_first_child/goto_next_sibling/goto_parent for efficient traversal
- Maintain correct pre-order and post-order semantics
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* chore: fix formatting
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent cfae6bd commit d7e2fb9
3 files changed
Lines changed: 34 additions & 13 deletions
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | | - | |
31 | | - | |
| 30 | + | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
37 | 42 | | |
38 | | - | |
39 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
40 | 52 | | |
41 | 53 | | |
| 54 | + | |
42 | 55 | | |
43 | | - | |
44 | | - | |
45 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
46 | 69 | | |
| 70 | + | |
| 71 | + | |
47 | 72 | | |
48 | 73 | | |
49 | 74 | | |
0 commit comments