Skip to content

⚡ Bolt: [성능 개선] CSS 및 해시 계산 캐싱#207

Open
seonghobae wants to merge 1 commit into
masterfrom
bolt-performance-css-hash-caching-18275415372841836981
Open

⚡ Bolt: [성능 개선] CSS 및 해시 계산 캐싱#207
seonghobae wants to merge 1 commit into
masterfrom
bolt-performance-css-hash-caching-18275415372841836981

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

💡 What
정적인 CSS 문자열(cssContent, css) 선언과 연산 비용이 높은 SHA-256 해시 계산(styleHash)을 process_dir 함수 내부에서 분리하여 파일 레벨의 private val 상수로 이동했습니다.

🎯 Why
기존 코드에서는 process_dir 함수가 호출될 때마다 (각 디렉토리마다) 무거운 SHA-256 해시 계산(MessageDigest 초기화 및 실행)과 긴 문자열의 템플릿 재생성이 중복해서 발생하고 있었습니다. 디렉토리가 많은 트리를 탐색할 경우 이러한 오버헤드가 누적되어 전체적인 성능 저하로 이어집니다.

📊 Impact
CSS 선언과 해시 계산이 애플리케이션 실행 중 단 1번만 계산(캐싱)되도록 보장합니다. 수천 개의 하위 디렉토리를 가진 구조를 크롤링할 경우 객체 생성 수와 암호화 연산을 대폭 줄여 눈에 띄는 메모리 및 CPU 사용량 개선이 기대됩니다.

🔬 Measurement
수천 개의 폴더를 생성해둔 대용량 테스트 환경에서 ./gradlew run --args="--max-level -1 /large-test-dir" 명령어를 수행하여 Profiler로 I/O, 메모리 할당 및 MessageDigest 실행 빈도가 O(1)로 줄어든 것을 확인할 수 있습니다.


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

- 정적인 CSS 문자열 선언과 값비싼 SHA-256 해시 계산을 `process_dir` 함수에서 분리하여 파일 레벨 `private val` 상수로 이동.
- 이 최적화를 통해 각각의 디렉토리를 순회할 때마다 불필요하게 발생하는 문자열 포맷팅 및 해시 생성 오버헤드를 완벽하게 제거함.
- `private val` 선언을 통해 Kotlin 컴파일러의 Public Getter 생성을 방지하여 Jacoco의 Line Coverage 하락을 막음.
@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