⚡ Bolt: 정적 자산(CSS 및 해시) 생성 객체 분리 최적화#255
Conversation
process_dir 함수 내에 있던 큰 정적 CSS 문자열과 SHA-256 해시 연산을 private object StaticAssets로 분리하여 디렉토리 크롤링 시 발생하는 불필요한 CPU 및 메모리 할당 병목을 제거했습니다.
|
👋 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. |
There was a problem hiding this comment.
Pull request overview
This PR refactors process_dir to avoid re-allocating a large static CSS string and re-computing its SHA-256 hash for every processed directory by extracting these immutable assets into a single private object StaticAssets.
Changes:
- Extracted the CSS payload and its SHA-256 CSP hash calculation into
private object StaticAssets. - Updated the generated HTML to reference
StaticAssets.styleHashandStaticAssets.cssinstead of per-call locals. - Documented the optimization as a new learning entry in
.jules/bolt.md.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/main/kotlin/html4tree/main.kt | Moves CSS + CSP hash generation to a static object and updates HTML template to reference it. |
| .jules/bolt.md | Adds a learning/action note documenting the static-asset extraction optimization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const val css = """ | ||
| <style> | ||
| ${cssContent} </style> | ||
| """ |
💡 What:
process_dir함수 내에 있던 큰 정적 CSS 문자열과 SHA-256 해시 계산 로직을private object StaticAssets로 추출했습니다.🎯 Why: 디렉토리를 순회할 때마다 변하지 않는 CSS 문자열을 반복해서 메모리에 할당하고 무거운 SHA-256 해시 연산을 수행하는 것은 심각한 CPU 및 메모리 오버헤드를 초래하기 때문입니다.
📊 Impact: 디렉토리 처리 시 불필요한 객체 할당 및 해시 연산을 완전히 제거하여 CPU 사용량을 줄이고 메모리 할당 및 가비지 컬렉션(GC) 압력을 크게 완화합니다.
🔬 Measurement: 수많은 디렉토리가 있는 대규모 파일 시스템을 대상으로 애플리케이션 실행 시간을 측정하거나 메모리 프로파일러를 통해 할당 횟수 감소를 확인할 수 있습니다.
PR created automatically by Jules for task 16232073909073812572 started by @seonghobae