From 0109e48e681a3137c05788ca5ff48a6340a2d37a Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sat, 5 Sep 2026 03:14:39 +0000 Subject: [PATCH 01/10] =?UTF-8?q?=E2=9A=A1=20Bolt:=20[=EC=84=B1=EB=8A=A5?= =?UTF-8?q?=20=EA=B0=9C=EC=84=A0]=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C?= =?UTF-8?q?=20=EB=AC=B8=EC=9E=90=EC=97=B4=20=ED=95=A0=EB=8B=B9=20=EB=B0=A9?= =?UTF-8?q?=EC=A7=80=EB=A5=BC=20=EC=9C=84=ED=95=9C=20=EC=A1=B0=EA=B1=B4?= =?UTF-8?q?=EB=AC=B8=20=EC=B5=9C=EC=A0=81=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .jules/bolt.md | 4 ++++ src/main/kotlin/html4tree/main.kt | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.jules/bolt.md b/.jules/bolt.md index ee124e69..01b7d214 100644 --- a/.jules/bolt.md +++ b/.jules/bolt.md @@ -62,3 +62,7 @@ ## 2026-08-11 - Array의 toMutableList 할당 오버헤드 최적화 **학습:** 배열을 정렬하기 위해 `.toMutableList()`를 호출하면 새로운 `ArrayList` 객체와 내부 배열 객체가 할당되어 대규모 디렉토리를 순회할 때 가비지 컬렉션(GC) 부하를 유발합니다. 배열 복제가 필요한 경우 `.clone()`을 사용하면 하나의 배열 객체만 새로 할당되므로 더 효율적입니다. **조치:** 디렉토리 파일 배열을 정렬하기 전에 복사할 때 `.toMutableList()` 대신 `.clone()`을 사용하여 불필요한 중간 컬렉션 할당을 제거하고 성능을 향상시켰습니다. + +## 2024-05-18 - 문자열 할당의 지연 평가를 통한 GC 부하 감소 +**Learning:** 핫 패스 루프에서 `toLowerCase()`와 같은 비싼 문자열 할당 연산을 가장 먼저 수행하면, 이후의 간단한 조건(`isHiddenFile()`, `endsWith()`)으로 인해 버려지는 객체들로 인해 불필요한 가비지 컬렉션(GC) 압력이 발생합니다. +**Action:** 빠른 반환이 가능한 저렴한 조건들을 먼저 평가하여, 실질적으로 변환이 필요한 경우에만 비싼 문자열 할당이 일어나도록 조건문을 재배치해야 합니다. diff --git a/src/main/kotlin/html4tree/main.kt b/src/main/kotlin/html4tree/main.kt index 0972fa2c..302b0daf 100644 --- a/src/main/kotlin/html4tree/main.kt +++ b/src/main/kotlin/html4tree/main.kt @@ -351,11 +351,15 @@ fun process_ignore_file(curr_dir: File, dirFilesNames: Array? = null): S // 보안 향상: dot-like prefixes and case variants of known sensitive names are excluded. (dirFilesNames ?: curr_dir.list())?.forEach { + // ⚡ Bolt Performance Optimization: Defer expensive string allocation (toLowerCase) + // Check cheap short-circuiting properties first. + if (it.isHiddenFile() || it.endsWith("~")) { + files_to_exclude.add(it) + return@forEach + } val normalizedName = it.toLowerCase(java.util.Locale.ROOT) if ( - it.isHiddenFile() || normalizedName in Constants.defaultSensitiveFileNamesLowercase || - normalizedName.endsWith("~") || Constants.defaultSensitiveExtensions.any { extension -> normalizedName.endsWith(extension) } From 459afe7ad0379b858b6d72fad194ae40e0fac0cd Mon Sep 17 00:00:00 2001 From: Seongho Bae Date: Sat, 5 Sep 2026 12:33:04 +0900 Subject: [PATCH 02/10] chore(perf): keep branch-local optimization out of repository doctrine Restore .jules/bolt.md to the protected-base blob. The condition-order change remains for measurement, but a branch-local micro-optimization is not promoted into repository-wide doctrine without reproducible profiling evidence. --- .jules/bolt.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.jules/bolt.md b/.jules/bolt.md index 01b7d214..ee124e69 100644 --- a/.jules/bolt.md +++ b/.jules/bolt.md @@ -62,7 +62,3 @@ ## 2026-08-11 - Array의 toMutableList 할당 오버헤드 최적화 **학습:** 배열을 정렬하기 위해 `.toMutableList()`를 호출하면 새로운 `ArrayList` 객체와 내부 배열 객체가 할당되어 대규모 디렉토리를 순회할 때 가비지 컬렉션(GC) 부하를 유발합니다. 배열 복제가 필요한 경우 `.clone()`을 사용하면 하나의 배열 객체만 새로 할당되므로 더 효율적입니다. **조치:** 디렉토리 파일 배열을 정렬하기 전에 복사할 때 `.toMutableList()` 대신 `.clone()`을 사용하여 불필요한 중간 컬렉션 할당을 제거하고 성능을 향상시켰습니다. - -## 2024-05-18 - 문자열 할당의 지연 평가를 통한 GC 부하 감소 -**Learning:** 핫 패스 루프에서 `toLowerCase()`와 같은 비싼 문자열 할당 연산을 가장 먼저 수행하면, 이후의 간단한 조건(`isHiddenFile()`, `endsWith()`)으로 인해 버려지는 객체들로 인해 불필요한 가비지 컬렉션(GC) 압력이 발생합니다. -**Action:** 빠른 반환이 가능한 저렴한 조건들을 먼저 평가하여, 실질적으로 변환이 필요한 경우에만 비싼 문자열 할당이 일어나도록 조건문을 재배치해야 합니다. From ef75a34131a78e058ea79b8f5930eaee6a50be83 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sat, 5 Sep 2026 12:06:44 +0000 Subject: [PATCH 03/10] =?UTF-8?q?=E2=9A=A1=20Bolt:=20[=EC=84=B1=EB=8A=A5?= =?UTF-8?q?=20=EA=B0=9C=EC=84=A0]=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C?= =?UTF-8?q?=20=EB=AC=B8=EC=9E=90=EC=97=B4=20=ED=95=A0=EB=8B=B9=20=EB=B0=A9?= =?UTF-8?q?=EC=A7=80=EB=A5=BC=20=EC=9C=84=ED=95=9C=20=EC=A1=B0=EA=B1=B4?= =?UTF-8?q?=EB=AC=B8=20=EC=B5=9C=EC=A0=81=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .jules/bolt.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.jules/bolt.md b/.jules/bolt.md index ee124e69..01b7d214 100644 --- a/.jules/bolt.md +++ b/.jules/bolt.md @@ -62,3 +62,7 @@ ## 2026-08-11 - Array의 toMutableList 할당 오버헤드 최적화 **학습:** 배열을 정렬하기 위해 `.toMutableList()`를 호출하면 새로운 `ArrayList` 객체와 내부 배열 객체가 할당되어 대규모 디렉토리를 순회할 때 가비지 컬렉션(GC) 부하를 유발합니다. 배열 복제가 필요한 경우 `.clone()`을 사용하면 하나의 배열 객체만 새로 할당되므로 더 효율적입니다. **조치:** 디렉토리 파일 배열을 정렬하기 전에 복사할 때 `.toMutableList()` 대신 `.clone()`을 사용하여 불필요한 중간 컬렉션 할당을 제거하고 성능을 향상시켰습니다. + +## 2024-05-18 - 문자열 할당의 지연 평가를 통한 GC 부하 감소 +**Learning:** 핫 패스 루프에서 `toLowerCase()`와 같은 비싼 문자열 할당 연산을 가장 먼저 수행하면, 이후의 간단한 조건(`isHiddenFile()`, `endsWith()`)으로 인해 버려지는 객체들로 인해 불필요한 가비지 컬렉션(GC) 압력이 발생합니다. +**Action:** 빠른 반환이 가능한 저렴한 조건들을 먼저 평가하여, 실질적으로 변환이 필요한 경우에만 비싼 문자열 할당이 일어나도록 조건문을 재배치해야 합니다. From da51b6e6aa5900038cc95795fdca93926dfa25fb Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sat, 5 Sep 2026 15:30:38 +0000 Subject: [PATCH 04/10] =?UTF-8?q?=E2=9A=A1=20Bolt:=20[=EC=84=B1=EB=8A=A5?= =?UTF-8?q?=20=EA=B0=9C=EC=84=A0]=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C?= =?UTF-8?q?=20=EB=AC=B8=EC=9E=90=EC=97=B4=20=ED=95=A0=EB=8B=B9=20=EB=B0=A9?= =?UTF-8?q?=EC=A7=80=EB=A5=BC=20=EC=9C=84=ED=95=9C=20=EC=A1=B0=EA=B1=B4?= =?UTF-8?q?=EB=AC=B8=20=EC=B5=9C=EC=A0=81=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 8407a1b5c183ea7a1e9f2d69fc4d0a11ed17dc7b Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sat, 5 Sep 2026 19:11:21 +0000 Subject: [PATCH 05/10] =?UTF-8?q?=E2=9A=A1=20Bolt:=20[=EC=84=B1=EB=8A=A5?= =?UTF-8?q?=20=EA=B0=9C=EC=84=A0]=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C?= =?UTF-8?q?=20=EB=AC=B8=EC=9E=90=EC=97=B4=20=ED=95=A0=EB=8B=B9=20=EB=B0=A9?= =?UTF-8?q?=EC=A7=80=EB=A5=BC=20=EC=9C=84=ED=95=9C=20=EC=A1=B0=EA=B1=B4?= =?UTF-8?q?=EB=AC=B8=20=EC=B5=9C=EC=A0=81=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/html4tree/main.kt | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/main/kotlin/html4tree/main.kt b/src/main/kotlin/html4tree/main.kt index 302b0daf..a061a067 100644 --- a/src/main/kotlin/html4tree/main.kt +++ b/src/main/kotlin/html4tree/main.kt @@ -351,17 +351,16 @@ fun process_ignore_file(curr_dir: File, dirFilesNames: Array? = null): S // 보안 향상: dot-like prefixes and case variants of known sensitive names are excluded. (dirFilesNames ?: curr_dir.list())?.forEach { - // ⚡ Bolt Performance Optimization: Defer expensive string allocation (toLowerCase) - // Check cheap short-circuiting properties first. - if (it.isHiddenFile() || it.endsWith("~")) { - files_to_exclude.add(it) - return@forEach - } - val normalizedName = it.toLowerCase(java.util.Locale.ROOT) if ( - normalizedName in Constants.defaultSensitiveFileNamesLowercase || - Constants.defaultSensitiveExtensions.any { extension -> - normalizedName.endsWith(extension) + it.isHiddenFile() || + it.endsWith("~") || + // ⚡ Bolt Performance Optimization: Defer expensive string allocation (toLowerCase) + // Evaluated only if cheap short-circuiting properties fail. + it.toLowerCase(java.util.Locale.ROOT).let { normalizedName -> + normalizedName in Constants.defaultSensitiveFileNamesLowercase || + Constants.defaultSensitiveExtensions.any { extension -> + normalizedName.endsWith(extension) + } } ) { files_to_exclude.add(it) From f41c097ce2f501ed5b94b5d7edd83f43ab15ed0f Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sat, 5 Sep 2026 23:37:02 +0000 Subject: [PATCH 06/10] =?UTF-8?q?=E2=9A=A1=20Bolt:=20[=EC=84=B1=EB=8A=A5?= =?UTF-8?q?=20=EA=B0=9C=EC=84=A0]=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C?= =?UTF-8?q?=20=EB=AC=B8=EC=9E=90=EC=97=B4=20=ED=95=A0=EB=8B=B9=20=EB=B0=A9?= =?UTF-8?q?=EC=A7=80=EB=A5=BC=20=EC=9C=84=ED=95=9C=20=EC=A1=B0=EA=B1=B4?= =?UTF-8?q?=EB=AC=B8=20=EC=B5=9C=EC=A0=81=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 620df4b05c78d28f2a9afe2135dd9d04ecaf0683 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sun, 6 Sep 2026 01:50:43 +0000 Subject: [PATCH 07/10] =?UTF-8?q?=E2=9A=A1=20Bolt:=20[=EC=84=B1=EB=8A=A5?= =?UTF-8?q?=20=EA=B0=9C=EC=84=A0]=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C?= =?UTF-8?q?=20=EB=AC=B8=EC=9E=90=EC=97=B4=20=ED=95=A0=EB=8B=B9=20=EB=B0=A9?= =?UTF-8?q?=EC=A7=80=EB=A5=BC=20=EC=9C=84=ED=95=9C=20=EC=A1=B0=EA=B1=B4?= =?UTF-8?q?=EB=AC=B8=20=EC=B5=9C=EC=A0=81=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 0641de536e7455127ac4defea266bed785404ac7 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sun, 6 Sep 2026 03:34:44 +0000 Subject: [PATCH 08/10] =?UTF-8?q?=E2=9A=A1=20Bolt:=20[=EC=84=B1=EB=8A=A5?= =?UTF-8?q?=20=EA=B0=9C=EC=84=A0]=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C?= =?UTF-8?q?=20=EB=AC=B8=EC=9E=90=EC=97=B4=20=ED=95=A0=EB=8B=B9=20=EB=B0=A9?= =?UTF-8?q?=EC=A7=80=EB=A5=BC=20=EC=9C=84=ED=95=9C=20=EC=A1=B0=EA=B1=B4?= =?UTF-8?q?=EB=AC=B8=20=EC=B5=9C=EC=A0=81=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 6871472d7ac830c95e75d2fdecf8a0792d97c92b Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sun, 6 Sep 2026 06:57:33 +0000 Subject: [PATCH 09/10] =?UTF-8?q?=E2=9A=A1=20Bolt:=20[=EC=84=B1=EB=8A=A5?= =?UTF-8?q?=20=EA=B0=9C=EC=84=A0]=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C?= =?UTF-8?q?=20=EB=AC=B8=EC=9E=90=EC=97=B4=20=ED=95=A0=EB=8B=B9=20=EB=B0=A9?= =?UTF-8?q?=EC=A7=80=EB=A5=BC=20=EC=9C=84=ED=95=9C=20=EC=A1=B0=EA=B1=B4?= =?UTF-8?q?=EB=AC=B8=20=EC=B5=9C=EC=A0=81=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From cb94e690efbc8d8234a3cf105f7965bb9c69e1e3 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sun, 6 Sep 2026 08:18:22 +0000 Subject: [PATCH 10/10] =?UTF-8?q?=E2=9A=A1=20Bolt:=20[=EC=84=B1=EB=8A=A5?= =?UTF-8?q?=20=EA=B0=9C=EC=84=A0]=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C?= =?UTF-8?q?=20=EB=AC=B8=EC=9E=90=EC=97=B4=20=ED=95=A0=EB=8B=B9=20=EB=B0=A9?= =?UTF-8?q?=EC=A7=80=EB=A5=BC=20=EC=9C=84=ED=95=9C=20=EC=A1=B0=EA=B1=B4?= =?UTF-8?q?=EB=AC=B8=20=EC=B5=9C=EC=A0=81=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit