Skip to content

⚡ Bolt: 불필요한 문자열 할당 방지를 통한 GC 오버헤드 최적화 - #790

Open
seonghobae wants to merge 3 commits into
masterfrom
bolt-optimize-tolowercase-13279296394468071615
Open

seonghobae wants to merge 3 commits into
masterfrom
bolt-optimize-tolowercase-13279296394468071615

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

💡 What: 디렉토리 순회 시 파일 필터링 로직에서 toLowerCase() 호출을 지연시켰습니다.
🎯 Why: 모든 파일 이름에 대해 toLowerCase()를 무조건 호출하면 중간 문자열 생성이 빈번하여 가비지 컬렉션 부하를 증가시킵니다. 저렴한 검사(isHiddenFile(), endsWith("~"))를 먼저 수행하여 이 오버헤드를 줄였습니다.
📊 Impact: 숨김 파일이나 임시 파일(~로 끝나는 파일)이 많은 대규모 디렉토리에서 문자열 할당이 줄어들어 렌더링 성능이 향상됩니다.
🔬 Measurement: ./gradlew clean test jacocoTestReport를 통해 기존 기능 보존 및 100% 커버리지 유지를 검증했습니다.


PR created automatically by Jules for task 13279296394468071615 started by @seonghobae

Summary by CodeRabbit

  • 개선 사항
    • 파일 제외 여부를 먼저 확인하도록 변경해 불필요한 문자열 변환을 줄였습니다. 숨김 파일과 백업 파일은 계속 제외되며, 민감한 이름과 확장자도 대소문자를 구분하지 않고 제외됩니다.

💡 What: 디렉토리 순회 시 파일 필터링 로직에서 `toLowerCase()` 호출을 지연시켰습니다.
🎯 Why: 모든 파일 이름에 대해 `toLowerCase()`를 무조건 호출하면 중간 문자열 생성이 빈번하여 가비지 컬렉션 부하를 증가시킵니다. 저렴한 검사(`isHiddenFile()`, `endsWith("~")`)를 먼저 수행하여 이 오버헤드를 줄였습니다.
📊 Impact: 숨김 파일이나 임시 파일(`~`로 끝나는 파일)이 많은 대규모 디렉토리에서 문자열 할당이 줄어들어 렌더링 성능이 향상됩니다.
🔬 Measurement: `./gradlew clean test jacocoTestReport`를 통해 기존 기능 보존 및 100% 커버리지 유지를 검증했습니다.
@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 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 5c96ec56-1bf8-4615-a74f-6d1ca0c0dfc3

📥 Commits

Reviewing files that changed from the base of the PR and between 728f0f3 and d5aa1ee.

📒 Files selected for processing (3)
  • .jules/bolt.md
  • src/main/kotlin/html4tree/main.kt
  • src/main/kotlin/html4tree/main.kt.orig

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

디렉토리 순회와 HTML 인덱스 기록 구현을 추가했습니다. 파일 제외 처리 순서를 변경해 숨김 이름과 백업 접미사를 먼저 검사합니다. CI 인프라 장애 대응 학습 항목도 추가했습니다.

Changes

HTML 디렉토리 인덱스 생성

Layer / File(s) Summary
CLI 입력과 디렉토리 순회
src/main/kotlin/html4tree/main.kt.orig
Clikt CLI, 최상위 경로 검증, 파일 신원 확인 및 제한된 디렉토리 순회 구현을 추가했습니다.
파일 제외 규칙과 필터 순서
src/main/kotlin/html4tree/main.kt.orig, src/main/kotlin/html4tree/main.kt, .jules/bolt.md
기본 제외 규칙과 .html4ignore 처리를 추가했습니다. 숨김 이름과 ~ 접미사를 먼저 검사한 뒤 나머지 이름을 소문자로 변환합니다. 관련 학습 항목을 추가했습니다.
HTML 생성과 인덱스 기록
src/main/kotlin/html4tree/main.kt.orig
HTML 이스케이프, URL 인코딩, 인덱스 HTML 생성 및 임시 파일을 통한 기록을 추가했습니다.

CI 인프라 장애 학습 항목

Layer / File(s) Summary
인프라 장애 대응 항목
.jules/bolt.md
CI 인프라 장애가 로그에서 확인되면 코드 변경 대신 우회하거나 submit을 재시도하라는 항목을 추가했습니다. 두 항목은 내용이 중복됩니다.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~50 minutes

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant Html4tree
  participant go
  participant crawl_directories
  participant process_ignore_file
  participant process_dir
  participant write_index_file
  Html4tree->>go: topDir와 maxLevel 전달
  go->>crawl_directories: 검증된 루트와 순회 깊이 전달
  crawl_directories->>process_ignore_file: 디렉토리 제외 규칙 확인
  crawl_directories->>process_dir: 디렉토리 항목 전달
  process_dir->>write_index_file: 생성한 HTML 기록 요청
Loading

Merge Risk: ⚪ Minimal · up to d5aa1

The filter change appears ready to merge after normal checks. Neither the backup file nor the duplicate heading establishes a blocking issue.

Architecture Summary

Architecture risk: 🔵 Low · up to d5aa1

The change affects 1 system.

Changed systems: src

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in src/main/kotlin/html4tree/main.kt: process_ignore_file now excludes hidden names and names ending in ~ first; other names are lowercased with Locale.ROOT and excluded if they match a configured sensitive name or end with a configured sensitive extension.
  • observed — Modified behavior in src/main/kotlin/html4tree/main.kt.orig: 패키지와 의존성을 선언하고, 반응형·접근성·다크 모드 스타일 및 Clikt 기반 CLI를 추가했습니다. CLI는 topDir과 기본값 -1인 maxLevel을 받아 go를 호출합니다.
  • observed — Modified behavior in src/main/kotlin/html4tree/main.kt.orig: FileIdentity와 read_file_identity를 추가했습니다. 파일 속성을 NOFOLLOW_LINKS로 읽어 키를 반환하고, 예외가 발생하면 읽기 실패 상태와 null 키를 반환합니다.
  • observed — Modified behavior in src/main/kotlin/html4tree/main.kt.orig: go는 빈 경로와 ..가 포함된 경로, 파일 시스템 루트, 존재하지 않거나 심볼릭 링크인 최상위 디렉토리를 거부합니다. 정규화한 절대 경로와 파일 신원 키로 순회를 시작합니다.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 불필요한 문자열 할당을 줄여 GC 오버헤드를 최적화한다는 주요 변경을 정확하게 설명합니다. 파일 필터링 전에 저렴한 검사를 수행해 toLowerCase() 할당을 줄이는 목적과 일치합니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

💡 What: 디렉토리 순회 시 파일 필터링 로직에서 `toLowerCase()` 호출을 지연시켰습니다.
🎯 Why: 모든 파일 이름에 대해 `toLowerCase()`를 무조건 호출하면 중간 문자열 생성이 빈번하여 가비지 컬렉션 부하를 증가시킵니다. 저렴한 검사(`isHiddenFile()`, `endsWith("~")`)를 먼저 수행하여 이 오버헤드를 줄였습니다.
📊 Impact: 숨김 파일이나 임시 파일(`~`로 끝나는 파일)이 많은 대규모 디렉토리에서 문자열 할당이 줄어들어 렌더링 성능이 향상됩니다.
🔬 Measurement: `./gradlew clean test jacocoTestReport`를 통해 기존 기능 보존 및 100% 커버리지 유지를 검증했습니다.
💡 What: 디렉토리 순회 시 파일 필터링 로직에서 `toLowerCase()` 호출을 지연시켰습니다.
🎯 Why: 모든 파일 이름에 대해 `toLowerCase()`를 무조건 호출하면 중간 문자열 생성이 빈번하여 가비지 컬렉션 부하를 증가시킵니다. 저렴한 검사(`isHiddenFile()`, `endsWith("~")`)를 먼저 수행하여 이 오버헤드를 줄였습니다.
📊 Impact: 숨김 파일이나 임시 파일(`~`로 끝나는 파일)이 많은 대규모 디렉토리에서 문자열 할당이 줄어들어 렌더링 성능이 향상됩니다.
🔬 Measurement: `./gradlew clean test jacocoTestReport`를 통해 기존 기능 보존 및 100% 커버리지 유지를 검증했습니다.
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