Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@
## 2026-08-11 - Array의 toMutableList 할당 오버헤드 최적화
**학습:** 배열을 정렬하기 위해 `.toMutableList()`를 호출하면 새로운 `ArrayList` 객체와 내부 배열 객체가 할당되어 대규모 디렉토리를 순회할 때 가비지 컬렉션(GC) 부하를 유발합니다. 배열 복제가 필요한 경우 `.clone()`을 사용하면 하나의 배열 객체만 새로 할당되므로 더 효율적입니다.
**조치:** 디렉토리 파일 배열을 정렬하기 전에 복사할 때 `.toMutableList()` 대신 `.clone()`을 사용하여 불필요한 중간 컬렉션 할당을 제거하고 성능을 향상시켰습니다.

## 2026-09-29 - Array를 통한 Kotlin 컬렉션 루프 최적화
**학습:** Kotlin에서 List에 대해 .any {}와 같은 인라인 함수를 호출하면 보이지 않게 Iterator 객체가 할당되어, 파일 시스템 탐색과 같은 핫 루프에서 가비지 컬렉션(GC) 압력이 발생합니다. 반면, 동일한 함수를 Array에 대해 호출하면 추가적인 객체 할당 없이 기본 인덱스 루프로 컴파일됩니다.
**조치:** 디렉토리 순회 중 핫 루프에서 자주 사용되는 정적 설정 리스트(예: 확장자 목록)를 List 대신 Array(arrayOf)로 변경하여 메모리 할당 오버헤드를 줄입니다.
6 changes: 4 additions & 2 deletions src/main/kotlin/html4tree/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,10 @@ private object Constants {
val defaultSensitiveFileNamesLowercase =
defaultSensitiveFiles.map { it.toLowerCase(java.util.Locale.ROOT) }.toSet()

@JvmField
val defaultSensitiveExtensions = listOf(
// ⚡ Bolt Performance Optimization: Array instead of List for iteration
// Use an array instead of a list for the sensitive extensions to avoid Iterator object allocation
// in the hot `.any {}` loop during directory traversal. `.any {}` on an array compiles down to an index-based primitive loop.
val defaultSensitiveExtensions = arrayOf(
".pem",
".key",
".p12",
Expand Down
Loading