From dcc1f901253ed108bfc5d57733c28c0ed01fa186 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Sat, 12 Sep 2026 18:12:10 -0700 Subject: [PATCH] perf: count bot comments without a filtered array (#20343) Co-authored-by: Orca Worker --- src/shared/pr-comment-audience.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/shared/pr-comment-audience.ts b/src/shared/pr-comment-audience.ts index 4736ab5c372..7542c17d851 100644 --- a/src/shared/pr-comment-audience.ts +++ b/src/shared/pr-comment-audience.ts @@ -55,7 +55,12 @@ export function getPRCommentAudienceCounts( comments: readonly PRComment[], botAuthorOverrides?: ReadonlySet ): Record { - const bot = comments.filter((comment) => isBotPRComment(comment, botAuthorOverrides)).length + let bot = 0 + comments.forEach((comment) => { + if (isBotPRComment(comment, botAuthorOverrides)) { + bot += 1 + } + }) return { all: comments.length, human: comments.length - bot, bot } }