Repository navigation
Commit 1c7f68d
committed
index: a name nothing defines is not a macro, and finding that out is two lookups
The hover's second, found by timing its stages: `macro_at_a_file_offset` took 1 016 ms of
a 1 027 ms hover. It asks `macro_environment(name, file)`, which walks every file the
cursor's file can reach -- 1 063 of them here -- and it is asked about *every* name a
reader points at: a local, a member, a class, a std:: type. Almost none of them is a
macro.
The index already files every `#define`/`#undef` by name, and the compilation's own table
holds the `-D`s and the compiler's predefines -- the only macros no file writes. A name
neither of them mentions is not a macro in any file, and the walk can only return nothing:
two lookups answer it, without the closure.
Measured, E:\EmmyLuaCodeStyle, LSPHandle.cpp, index settled:
before after
hover, cold 1 027 ms 10.2 ms
hover, after edit 1 057 ms 10.3 ms
hover, warm 20 ms 11 ms
The one answer this can be wrong about is a macro written in a file the index has not read
yet -- it says "not a macro here" until that file is read, which is the answer the walk
would give for an unread file too, and the name questions after it still answer.
168/170 suites green; clippy clean.1 parent f5a7d30 commit 1c7f68d
3 files changed
Lines changed: 55 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1169 | 1169 | | |
1170 | 1170 | | |
1171 | 1171 | | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
1172 | 1181 | | |
1173 | 1182 | | |
1174 | 1183 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15667 | 15667 | | |
15668 | 15668 | | |
15669 | 15669 | | |
| 15670 | + | |
| 15671 | + | |
| 15672 | + | |
| 15673 | + | |
| 15674 | + | |
| 15675 | + | |
| 15676 | + | |
| 15677 | + | |
| 15678 | + | |
| 15679 | + | |
| 15680 | + | |
| 15681 | + | |
| 15682 | + | |
| 15683 | + | |
| 15684 | + | |
| 15685 | + | |
| 15686 | + | |
15670 | 15687 | | |
15671 | 15688 | | |
15672 | 15689 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
266 | 281 | | |
267 | 282 | | |
268 | 283 | | |
269 | 284 | | |
270 | 285 | | |
271 | 286 | | |
272 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
273 | 291 | | |
274 | 292 | | |
275 | 293 | | |
| |||
361 | 379 | | |
362 | 380 | | |
363 | 381 | | |
364 | | - | |
| 382 | + | |
365 | 383 | | |
366 | 384 | | |
367 | 385 | | |
368 | 386 | | |
369 | 387 | | |
370 | 388 | | |
371 | 389 | | |
372 | | - | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
373 | 394 | | |
374 | 395 | | |
375 | 396 | | |
| |||
386 | 407 | | |
387 | 408 | | |
388 | 409 | | |
389 | | - | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
390 | 414 | | |
391 | 415 | | |
392 | 416 | | |
| |||
400 | 424 | | |
401 | 425 | | |
402 | 426 | | |
403 | | - | |
| 427 | + | |
404 | 428 | | |
405 | 429 | | |
406 | 430 | | |
| |||
0 commit comments