mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-10-27 07:51:52 +00:00
perf: parallelize log processing in summarize-lock-reliability.mjs
Replaces sequential file processing loop with Promise.all to improve performance. Benchmark showed ~2.5x speedup (1638ms -> 658ms) on 2000 files. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
264e2b5f61
commit
18eedc7810
1 file changed
+8
-2
@@ -182,10 +182,16 @@ async function main() {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const entry of entries) {
|
||||
const promises = entries.map(async (entry) => {
|
||||
const fullPath = path.join(cadenceDir, entry);
|
||||
logsScanned += 1;
|
||||
const record = await readLogFile(fullPath, cadence, cutoffMs);
|
||||
return record;
|
||||
});
|
||||
|
||||
const results = await Promise.all(promises);
|
||||
logsScanned += entries.length;
|
||||
|
||||
for (const record of results) {
|
||||
if (!record) continue;
|
||||
|
||||
records.push(record);
|
||||
|
||||
Reference in new issue
Block a user