⚡ Bolt: CSS 콘텐츠 및 해시 연산을 최상위 프로퍼티로 추출하여 디렉토리 렌더링 성능 최적화 - #272
Conversation
|
👋 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
Moves per-directory CSS string construction and SHA-256 CSP style hash computation out of process_dir into top-level properties to avoid repeated work during directory rendering in the Kotlin CLI.
Changes:
- Extracted
cssContent,styleHash, andcssto file top-level properties inmain.kt. - Added a unit test intended to keep coverage at 100% for the new top-level properties.
- Documented the performance learning in
.jules/bolt.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/main/kotlin/html4tree/main.kt | Hoists static CSS + SHA-256 hash computation to top-level properties used by process_dir and CSP generation. |
| src/test/kotlin/html4tree/MainTest.kt | Adds a test touching the new top-level CSS/hash properties for coverage/verification. |
| .jules/bolt.md | Adds a Bolt learning note describing the rationale for hoisting the hash/string work. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| val exclude: Set<String> = excludeSet ?: process_ignore_file(curr_dir) | ||
|
|
||
| val cssContent = """ | ||
| val cssContent = """ |
| val styleHash = "sha256-" + Base64.getEncoder().encodeToString(MessageDigest.getInstance("SHA-256").digest(cssContent.toByteArray(Charsets.UTF_8))) | ||
|
|
||
| val css = """ | ||
| val css = """ | ||
| <style> | ||
| ${cssContent} </style> |
|
|
||
| @Test | ||
| fun testTopLevelCssProperties() { | ||
| assertTrue(cssContent.isNotEmpty()) | ||
| assertTrue(styleHash.startsWith("sha256-")) | ||
| assertTrue(css.contains("body {")) | ||
| } |
|
Closing as superseded by canonical #363. The same static stylesheet and SHA-256 work is moved out of |
Understood. Acknowledging that this work is now superseded by #363 and stopping work on this task. |
💡 What:
src/main/kotlin/html4tree/main.kt에서 재귀적으로 호출되는process_dir내에 있던 정적 CSS 문자열(cssContent,css)과 비용이 많이 드는 SHA-256 암호화 해시 계산(styleHash)을 파일 최상위(top-level) 프로퍼티로 이동했습니다.🎯 Why: 디렉토리를 렌더링할 때마다 불필요하게 동일한 문자열 객체가 생성되고 무거운 암호화 해시가 반복 계산되어 가비지 컬렉션(GC) 압력과 성능 병목이 발생했습니다.
📊 Impact: 디렉토리 개수(N)만큼 반복되던 O(N) 연산과 메모리 할당을 애플리케이션 시작 시 1회만 계산되는 O(1)로 줄여 CPU 및 메모리 사용량을 대폭 최적화했습니다.
🔬 Measurement: JaCoCo 명령어 커버리지 100%를 성공적으로 유지하며 (
testTopLevelCssProperties테스트 추가), 기존의 테스트 스위트를 모두 통과하는 것을 확인했습니다.PR created automatically by Jules for task 6561448932755046198 started by @seonghobae