-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit 4d591ff
perf(@schematics/angular): optimize AST traversal utilities
Improves the performance of AST utility functions by reducing redundant work and memory allocations.
- The `findNodes` function is now memoized with a `WeakMap`-based cache. This prevents repeated traversals of the entire source file AST when searching for nodes of the same kind, which is a common pattern.
- The `getSourceNodes` function has been refactored to use a single array instead of two, reducing memory overhead and avoiding costly `shift()` operations.1 parent db775e1 commit 4d591ff
1 file changed
+26
-11
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
91 | 91 |
| |
92 | 92 |
| |
93 | 93 |
| |
94 | + | ||
95 | + | ||
96 | + | ||
97 | + | ||
98 | + | ||
94 | 99 |
| |
95 | 100 |
| |
96 | 101 |
| |
| |||
138 | 143 |
| |
139 | 144 |
| |
140 | 145 |
| |
146 | + | ||
147 | + | ||
148 | + | ||
149 | + | ||
150 | + | ||
151 | + | ||
152 | + | ||
153 | + | ||
141 | 154 |
| |
142 | 155 |
| |
143 | 156 |
| |
| |||
158 | 171 |
| |
159 | 172 |
| |
160 | 173 |
| |
174 | + | ||
175 | + | ||
176 | + | ||
177 | + | ||
178 | + | ||
179 | + | ||
180 | + | ||
181 | + | ||
182 | + | ||
161 | 183 |
| |
162 | 184 |
| |
163 | 185 |
| |
| |||
168 | 190 |
| |
169 | 191 |
| |
170 | 192 |
| |
171 | - | ||
172 | - | ||
173 | - | ||
174 | - | ||
175 | 193 |
| |
176 | - | ||
177 | - | ||
178 | - | ||
179 | - | ||
180 | - | ||
181 | - | ||
194 | + | ||
195 | + | ||
196 | + | ||
182 | 197 |
| |
183 | 198 |
| |
184 | - | ||
199 | + | ||
185 | 200 |
| |
186 | 201 |
| |
187 | 202 |
| |
|
0 commit comments