Commit 93fd467
defer suggested stdlib imports to diagnostic display & use global cache
Summary:
strsim::levenshtein was using 12% of our CPU time from profiling initial indexing on langchain/dify
when we fail to find a module, we check the distance between the module name & all the stdlib modules, and compute a list of suggestions (did you mean...?) for the error message.
this computation is very expensive and uncached, and mostly unnecessary since we don't emit diagnostics for most files during indexing.
this diff makes it so that we only compute the suggestions when we display an error, and use a global cache for the suggestions.
Reviewed By: rchen152
Differential Revision: D91750918
fbshipit-source-id: 1e88754c540ad79fcfc4f8bf84f5c13c8078cd8f1 parent d2e29e3 commit 93fd467
2 files changed
+27
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
21 | 28 | | |
22 | 29 | | |
23 | 30 | | |
| |||
641 | 648 | | |
642 | 649 | | |
643 | 650 | | |
644 | | - | |
645 | 651 | | |
646 | 652 | | |
647 | 653 | | |
| |||
698 | 704 | | |
699 | 705 | | |
700 | 706 | | |
701 | | - | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
702 | 715 | | |
703 | 716 | | |
704 | 717 | | |
| |||
1054 | 1067 | | |
1055 | 1068 | | |
1056 | 1069 | | |
1057 | | - | |
1058 | 1070 | | |
1059 | 1071 | | |
1060 | 1072 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
54 | | - | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | 82 | | |
86 | 83 | | |
87 | 84 | | |
88 | 85 | | |
89 | 86 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
94 | 98 | | |
95 | 99 | | |
96 | 100 | | |
| |||
0 commit comments