Commit 4f2ede6
committed
perf: add O(1) lookup caching for ProjectNode document entries
- Cache root document entry for O(1) getRootDocumentEntry()
- Use direct hash lookup for getDocumentEntry() instead of iteration
- Properly rekey array in setDocumentEntries() via addDocumentEntry()
- Invalidate cache on reset()
The functional test is updated to mark the document as root before
compilation (using withIsRoot(true)) so the compiler creates the
DocumentEntryNode correctly, rather than pre-creating an entry that
gets overwritten by the compiler.1 parent 8acd95a commit 4f2ede6
File tree
2 files changed
+22
-15
lines changed- packages/guides/src/Nodes
- tests/Functional
2 files changed
+22
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| |||
182 | 185 | | |
183 | 186 | | |
184 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
185 | 193 | | |
186 | 194 | | |
187 | 195 | | |
| |||
193 | 201 | | |
194 | 202 | | |
195 | 203 | | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
| 204 | + | |
| 205 | + | |
200 | 206 | | |
201 | 207 | | |
202 | 208 | | |
| |||
205 | 211 | | |
206 | 212 | | |
207 | 213 | | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
212 | 217 | | |
213 | 218 | | |
214 | 219 | | |
| |||
217 | 222 | | |
218 | 223 | | |
219 | 224 | | |
220 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
221 | 231 | | |
222 | 232 | | |
223 | 233 | | |
| |||
228 | 238 | | |
229 | 239 | | |
230 | 240 | | |
| 241 | + | |
231 | 242 | | |
232 | 243 | | |
233 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | 28 | | |
30 | 29 | | |
31 | | - | |
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
| |||
110 | 108 | | |
111 | 109 | | |
112 | 110 | | |
113 | | - | |
114 | | - | |
| 111 | + | |
115 | 112 | | |
116 | 113 | | |
117 | 114 | | |
118 | 115 | | |
119 | | - | |
120 | 116 | | |
121 | 117 | | |
122 | 118 | | |
| |||
0 commit comments