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
3 changes: 3 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@
## 2026-08-11 - Array의 toMutableList 할당 오버헤드 최적화
**학습:** 배열을 정렬하기 위해 `.toMutableList()`를 호출하면 새로운 `ArrayList` 객체와 내부 배열 객체가 할당되어 대규모 디렉토리를 순회할 때 가비지 컬렉션(GC) 부하를 유발합니다. 배열 복제가 필요한 경우 `.clone()`을 사용하면 하나의 배열 객체만 새로 할당되므로 더 효율적입니다.
**조치:** 디렉토리 파일 배열을 정렬하기 전에 복사할 때 `.toMutableList()` 대신 `.clone()`을 사용하여 불필요한 중간 컬렉션 할당을 제거하고 성능을 향상시켰습니다.
## 2024-05-24 - Defer string allocations in loops
**Learning:** In hot loops, deferring expensive string allocations like `toLowerCase()` until after cheap, short-circuiting properties like `isHiddenFile()` or `endsWith()` can significantly reduce GC pressure.
**Action:** Always evaluate cheap checks first before transforming strings in loops.
7 changes: 5 additions & 2 deletions src/main/kotlin/html4tree/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,14 @@ fun process_ignore_file(curr_dir: File, dirFilesNames: Array<String>? = 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 allocations until after cheap short-circuit properties
if (it.isHiddenFile() || it.endsWith("~")) {
files_to_exclude.add(it)
return@forEach
Comment thread
seonghobae marked this conversation as resolved.
}
val normalizedName = it.toLowerCase(java.util.Locale.ROOT)
if (
it.isHiddenFile() ||
normalizedName in Constants.defaultSensitiveFileNamesLowercase ||
normalizedName.endsWith("~") ||
Constants.defaultSensitiveExtensions.any { extension ->
normalizedName.endsWith(extension)
}
Expand Down
Loading