⚡ Bolt: 배열 생성 시 중간 ArrayList 할당 제거 (Avoid intermediate ArrayList allocation) - #407
⚡ Bolt: 배열 생성 시 중간 ArrayList 할당 제거 (Avoid intermediate ArrayList allocation)#407seonghobae wants to merge 1 commit into
Conversation
…cation)
Kotlin에서 `Collection.map { ... }.toTypedArray()`를 사용하면 중간에 불필요한 `ArrayList`가 생성되어 가비지 컬렉션(GC) 및 메모리 할당 오버헤드가 발생합니다. 핫 패스에서는 이로 인한 성능 저하가 큽니다.
이를 해결하기 위해 `Array(size) { index -> ... }` 생성자를 직접 사용하여 배열을 직접 초기화하여 성능을 개선했습니다.
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
Changes배열 생성 최적화
Estimated code review effort: 1 (매우 간단) | ~5분 Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
💡 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
성능 개선
문서