Skip to content

⚡ Bolt: 배열 생성 시 중간 ArrayList 할당 제거 (Avoid intermediate ArrayList allocation) - #407

Open
seonghobae wants to merge 1 commit into
masterfrom
bolt-avoid-arraylist-allocation-2163167260730974646
Open

⚡ Bolt: 배열 생성 시 중간 ArrayList 할당 제거 (Avoid intermediate ArrayList allocation)#407
seonghobae wants to merge 1 commit into
masterfrom
bolt-avoid-arraylist-allocation-2163167260730974646

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

💡 What: crawl_directories의 핫 패스 루프에서 dirFiles?.map { it.name }?.toTypedArray()dirFiles?.let { files -> Array(files.size) { files[it].name } }로 변경했습니다.
🎯 Why: 기존 방식은 배열을 생성하기 전에 임시 ArrayList를 할당하여 디렉토리가 많은 파일 시스템을 순회할 때 가비지 컬렉터(GC)에 불필요한 압력을 가하고 메모리 할당 오버헤드를 발생시켰습니다.
📊 Impact: 디렉토리를 읽어 배열로 변환하는 동안 발생하는 불필요한 메모리 할당을 줄여 크롤링 속도를 최적화합니다.
🔬 Measurement: Jacoco 커버리지가 여전히 100%를 달성하고 모든 기존 단위 테스트가 문제없이 통과하는 것을 확인했습니다.


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

Summary by CodeRabbit

  • 성능 개선

    • 디렉터리 파일명 목록 생성 방식을 최적화해 불필요한 중간 할당을 줄였습니다.
    • 기존 파일명 데이터와 제외 처리 결과는 동일하게 유지됩니다.
  • 문서

    • 배열 생성 시 효율적인 방식을 사용하기 위한 개발 지침을 추가했습니다.

…cation)

Kotlin에서 `Collection.map { ... }.toTypedArray()`를 사용하면 중간에 불필요한 `ArrayList`가 생성되어 가비지 컬렉션(GC) 및 메모리 할당 오버헤드가 발생합니다. 핫 패스에서는 이로 인한 성능 저하가 큽니다.
이를 해결하기 위해 `Array(size) { index -> ... }` 생성자를 직접 사용하여 배열을 직접 초기화하여 성능을 개선했습니다.
@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 Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 75013888-45d7-4dd8-b531-60de8b7a3764

📥 Commits

Reviewing files that changed from the base of the PR and between 29e1534 and 96ebd50.

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

📝 Walkthrough

Walkthrough

crawl_directories의 파일명 배열 생성을 직접 크기의 Array 생성 방식으로 변경했습니다. 중간 ArrayList 할당을 피하는 최적화 지침도 추가했습니다.

Changes

배열 생성 최적화

Layer / File(s) Summary
직접 Array 생성 및 최적화 지침
src/main/kotlin/html4tree/main.kt, .jules/bolt.md
crawl_directoriesmap { ... }.toTypedArray() 대신 인덱스 기반 Array를 사용합니다. 동일한 배열 생성 최적화 지침을 문서에 추가했습니다.

Estimated code review effort: 1 (매우 간단) | ~5분

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 핫 패스에서 중간 ArrayList 할당을 제거하는 배열 생성 최적화를 정확하고 간결하게 설명합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bolt-avoid-arraylist-allocation-2163167260730974646

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.

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