Version
built from source, main @ 2278498 (v0.11.0-186)
Platform
Linux (x64)
Install channel
Built from source
Binary variant
standard
What happened, and what did you expect?
.d always maps to D (src/discover/language.c:406). Make-style dependency files written by cargo/rustc, gcc/clang -MD and CMake therefore go through the D grammar and then the unbudgeted unified walk (internal/cbm/cbm.c:301). They yield nothing useful, and the cost grows superlinearly with size: a 128 KB cargo dep-info file takes about 2 s to parse and 13 s to walk. Discovery always skips only target/, so a cargo --target-dir with another name, or in-tree -MD output that is not gitignored, gets indexed.
My fix adds cbm_disambiguate_d, a 4 KB first-line sniff in the shape of the .frm/.cls/.m disambiguators (#2074) and the new .res one (#2352). It drops a .d file only when its first non-blank line is a make rule whose targets all look like paths, and keeps D on any doubt. Dep-info files lose their File/Module/Folder nodes (they were never D source), so please confirm that is the behavior you want.
Reproduction
Repro: copy the .d files from a cargo target/debug/deps into a directory with a few .rs files and index it.
| Linux x86_64, 32 logical CPUs, GCC 16 |
main |
fixed |
Cold index, 200 real cargo dep-info files (16-205 KB) + 3 .rs |
109 s, 858 CPU-s, 327 MB RSS, 17 parse timeouts |
1.3 s, 1.0 CPU-s, 81 MB, 0 timeouts |
| Real cargo dep-info files detected as D |
26,157 of 26,157 |
0 |
| Real D files detected as D (phobos, dmd, ldc, dub, vibe.d) |
12,062 of 12,062 |
12,062 of 12,062 |
Logs
Diagnostics trajectory (memory / performance / leak issues)
Not a leak: the CPU time and peak RSS above are for one cold index run of the repro directory.
Project scale (if relevant)
No response
Confirmations
Version
built from source, main @ 2278498 (v0.11.0-186)
Platform
Linux (x64)
Install channel
Built from source
Binary variant
standard
What happened, and what did you expect?
.dalways maps to D (src/discover/language.c:406). Make-style dependency files written by cargo/rustc, gcc/clang-MDand CMake therefore go through the D grammar and then the unbudgeted unified walk (internal/cbm/cbm.c:301). They yield nothing useful, and the cost grows superlinearly with size: a 128 KB cargo dep-info file takes about 2 s to parse and 13 s to walk. Discovery always skips onlytarget/, so a cargo--target-dirwith another name, or in-tree-MDoutput that is not gitignored, gets indexed.My fix adds
cbm_disambiguate_d, a 4 KB first-line sniff in the shape of the.frm/.cls/.mdisambiguators (#2074) and the new.resone (#2352). It drops a.dfile only when its first non-blank line is a make rule whose targets all look like paths, and keeps D on any doubt. Dep-info files lose their File/Module/Folder nodes (they were never D source), so please confirm that is the behavior you want.Reproduction
Repro: copy the
.dfiles from a cargotarget/debug/depsinto a directory with a few.rsfiles and index it..rsLogs
Diagnostics trajectory (memory / performance / leak issues)
Project scale (if relevant)
No response
Confirmations