Skip to content

⚡ Bolt: CSS 정적 자원 및 해싱 중복 연산(O(N) -> O(1)) 최적화#181

Open
seonghobae wants to merge 4 commits into
masterfrom
bolt-static-css-hash-17542304757435960926
Open

⚡ Bolt: CSS 정적 자원 및 해싱 중복 연산(O(N) -> O(1)) 최적화#181
seonghobae wants to merge 4 commits into
masterfrom
bolt-static-css-hash-17542304757435960926

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

💡 What: src/main/kotlin/html4tree/main.ktprocess_dir 내부에 존재하던 고정된 CSS 문자열(cssContent)과 이를 이용한 SHA-256 해시 계산(styleHash)을 파일 레벨의 private object StaticCss로 추출했습니다.
🎯 Why: process_dir은 크롤링하는 모든 디렉토리마다 재귀적/반복적으로 호출됩니다. 이 내부에서 고정된 문자열에 대해 매번 MessageDigest.getInstance("SHA-256").digest(...)와 Base64 인코딩을 수행하는 것은 O(N)의 중복 계산을 유발하는 치명적인 성능 병목이었습니다. 이를 전역 레벨로 한 번만 계산(O(1))하도록 하여 자원 낭비를 줄입니다. Kotlin 컴파일러가 암묵적 getter를 생성해 JaCoCo 100% 커버리지가 깨지는 현상을 방지하기 위해 private object 내부에 캡슐화하고 @JvmFieldconst val을 적절히 사용했습니다.
📊 Impact: 디렉토리 수가 많을수록 비례하여 증가하던 SHA-256 암호화 해시 연산 횟수를 단 1회로 줄였으며, 반복적인 긴 문자열(cssContent) 할당도 방지합니다. CPU 및 메모리 가비지 컬렉션 부하를 대폭 줄입니다.
🔬 Measurement: ./gradlew test jacocoTestReport jacocoTestCoverageVerification를 실행하여 모든 기능이 정상 작동하며 테스트 커버리지가 기존과 동일한 100%를 유지함을 확인했습니다.


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

@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.

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