From 04b4a0e4be6fe01db6bce0498988e5c65b77fa1d Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Sat, 12 Sep 2026 18:02:46 -0700 Subject: [PATCH] perf(files): skip unused Quick Open byte accounting (#20216) Co-authored-by: Orca Worker --- src/main/ipc/filesystem-list-files.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/ipc/filesystem-list-files.ts b/src/main/ipc/filesystem-list-files.ts index dee1224b4b1..0707e1b3136 100644 --- a/src/main/ipc/filesystem-list-files.ts +++ b/src/main/ipc/filesystem-list-files.ts @@ -132,12 +132,14 @@ export async function listQuickOpenFiles( if (maxResults !== undefined && files.size >= maxResults) { return true } - const nextBytes = serializedQuickOpenPathBytes(relPath) + (files.size === 0 ? 0 : 1) - if (maxSerializedBytes !== undefined && serializedBytes + nextBytes > maxSerializedBytes) { - return true + if (maxSerializedBytes !== undefined) { + const nextBytes = serializedQuickOpenPathBytes(relPath) + (files.size === 0 ? 0 : 1) + if (serializedBytes + nextBytes > maxSerializedBytes) { + return true + } + serializedBytes += nextBytes } files.add(relPath) - serializedBytes += nextBytes return maxResults !== undefined && files.size >= maxResults }