Skip to content

perf(ignore): evaluate array-backed sensitive-extension scan - #775

Draft
seonghobae wants to merge 4 commits into
masterfrom
bolt-array-optimization-12184628509900712740
Draft

seonghobae wants to merge 4 commits into
masterfrom
bolt-array-optimization-12184628509900712740

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Scope correction

defaultSensitiveExtensions를 List에서 Array로 바꾸면 any {}의 구현 경로가 달라져 반복 검사에서 중간 iterator 할당을 피할 가능성은 있습니다. 다만 현재 저장소에는 이 21개 고정 확장자 검사가 실제 crawl hot path의 병목이라는 profile, allocation trace, GC evidence, end-to-end benchmark가 없습니다. 따라서 “GC 부하를 대폭 줄인다”는 generated 주장은 merge authority로 사용하지 않습니다.

Repair

Generated head에는 실제 후보 외에 두 가지 불필요한 artifact가 섞여 있었습니다.

  • retrospective .jules/bolt.md doctrine
  • production main.kt 전체를 복제한 src/main/kotlin/html4tree/main.kt.orig

둘은 ordinary non-force descendant에서 제거/복구했습니다. Generated commit은 ancestry에 그대로 남아 있습니다.

  • protected base: master@728f0f33323e43573d6664209891099502827d5d
  • exact head: 82cf2ead3c4a976688d8259958de0d71128a26dd
  • current effective diff: src/main/kotlin/html4tree/main.kt 1개 파일, +2/-1
  • force push / destructive rebase 없음

현재 source comment도 allocation 효과를 측정된 사실처럼 읽힐 수 있으므로 Ready 전에는 evidence-neutral rationale로 바꾸거나, 실제 allocation evidence가 그 문구를 직접 뒷받침해야 합니다.

Semantic acceptance

같은 exact head에서 최소한 다음을 보호해야 합니다.

  • 기존 sensitive extension 전체와 대소문자 normalization 동작 동일
  • ordinary name, hidden/dot-like prefix, backup suffix(~), sensitive exact-name 경계 불변
  • empty/single/multiple directory entries와 dirFilesNames == null fallback 경계 불변
  • Array 공개 타입 변화가 repository 내 테스트/호출자 계약을 깨지 않음

Performance acceptance

동일 JDK/Kotlin/runtime/host에서 protected base와 candidate를 비교하고, right-cleared representative directory distributions로 extension-check 호출 수, allocation bytes/op, iterator allocation count, heap/GC count+pause, crawl wall/CPU median·p95를 함께 기록해야 합니다. 21개 확장자 선형 scan 자체가 지배 비용이 아니거나 차이가 noise면 성능 주장 없이 유지할 독립적 이유가 있는지 다시 판단합니다.

Exact-head CI/JaCoCo/Security/SAST/CodeQL과 current-head review가 terminal GREEN이 되기 전에는 Draft를 유지합니다. predecessor GREEN, source-neutral retrigger, self-approval, gate weakening은 사용하지 않습니다.

💡 What: `Constants.defaultSensitiveExtensions`를 `List`에서 `Array`로 변경했습니다.
🎯 Why: 디렉토리에 있는 수많은 파일들을 순회하면서 매번 `defaultSensitiveExtensions.any { ... }`를 호출할 때 `List`는 매번 `Iterator` 객체를 생성하여 GC(가비지 컬렉션) 부하를 유발합니다. 반면 Kotlin에서 `Array`의 `any` 호출은 Iterator 할당 없이 인덱스 기반으로 최적화됩니다.
📊 Impact: 디렉터리 내 파일 개수만큼 발생하던 `Iterator` 할당을 제거하여, 파일이 많은 디렉터리 처리 시 이론적으로 메모리 사용량과 GC 부하를 대폭 줄여줍니다.
🔬 Measurement: 대규모 디렉토리를 크롤링할 때의 메모리 프로파일링 시 `Iterator` 객체 할당 횟수 및 GC 시간으로 확인할 수 있습니다.
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae
seonghobae marked this pull request as draft September 23, 2026 22:45
@seonghobae seonghobae changed the title ⚡ Bolt: 확장자 검사 시 Array 도입으로 Iterator 할당 성능 개선 perf(ignore): evaluate array-backed sensitive-extension scan Sep 23, 2026
💡 What: `Constants.defaultSensitiveExtensions`를 `List`에서 `Array`로 변경했습니다.
🎯 Why: 디렉토리에 있는 수많은 파일들을 순회하면서 매번 `defaultSensitiveExtensions.any { ... }`를 호출할 때 `List`는 매번 `Iterator` 객체를 생성하여 GC(가비지 컬렉션) 부하를 유발합니다. 반면 Kotlin에서 `Array`의 `any` 호출은 Iterator 할당 없이 인덱스 기반으로 최적화됩니다.
📊 Impact: 디렉터리 내 파일 개수만큼 발생하던 `Iterator` 할당을 제거하여, 파일이 많은 디렉터리 처리 시 이론적으로 메모리 사용량과 GC 부하를 대폭 줄여줍니다.
🔬 Measurement: 대규모 디렉토리를 크롤링할 때의 메모리 프로파일링 시 `Iterator` 객체 할당 횟수 및 GC 시간으로 확인할 수 있습니다.
💡 What: `Constants.defaultSensitiveExtensions`를 `List`에서 `Array`로 변경했습니다.
🎯 Why: 디렉토리에 있는 수많은 파일들을 순회하면서 매번 `defaultSensitiveExtensions.any { ... }`를 호출할 때 `List`는 매번 `Iterator` 객체를 생성하여 GC(가비지 컬렉션) 부하를 유발합니다. 반면 Kotlin에서 `Array`의 `any` 호출은 Iterator 할당 없이 인덱스 기반으로 최적화됩니다.
📊 Impact: 디렉터리 내 파일 개수만큼 발생하던 `Iterator` 할당을 제거하여, 파일이 많은 디렉터리 처리 시 이론적으로 메모리 사용량과 GC 부하를 대폭 줄여줍니다.
🔬 Measurement: 대규모 디렉토리를 크롤링할 때의 메모리 프로파일링 시 `Iterator` 객체 할당 횟수 및 GC 시간으로 확인할 수 있습니다.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant