дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 18:17:15 +02:00
perf(code-insight): read usage lines of many files in one call (#7598)
Usage lists read the line text of each file with one IPC call per file, which for ~1800 files took as long as the references request. fs_read_texts reads them in one call on a few threads (265-377 ms -> 57-59 ms on macOS); open editors and virtual documents keep using their editor text. Refs #6823
Цей коміт міститься в:
1 джерело
f39b728947
коміт
eace2fc741
5 files changed
+56
-15
No files matched your search
@@ -115,19 +115,7 @@ export async function previewText(path: string): Promise<string> {
|
||||
return lines.join("\n");
|
||||
}
|
||||
|
||||
export async function readManyFileLines(
|
||||
paths: readonly string[],
|
||||
concurrency = 4,
|
||||
): Promise<Map<string, string[] | null>> {
|
||||
const out = new Map<string, string[] | null>();
|
||||
const queue = [...new Set(paths)];
|
||||
const worker = async () => {
|
||||
// oxlint-disable-next-line no-await-in-loop -- bounded worker pool: queue.shift() limits fan-out to `concurrency`
|
||||
for (let p = queue.shift(); p !== undefined; p = queue.shift()) out.set(p, await readFileLines(p));
|
||||
};
|
||||
await Promise.all(Array.from({ length: Math.min(concurrency, queue.length) }, worker));
|
||||
return out;
|
||||
}
|
||||
export { readManyFileLines } from "@/editor/lsp/files";
|
||||
|
||||
/**
|
||||
* Runs `fn` with a backend document id for `path`, holding a reference only
|
||||
|
||||
Reference in new issue
Заблокувати користувача