⚡ Bolt: [성능 개선] String.format 기반 hex 변환을 HexFormat.of().formatHex()로 대체#60
⚡ Bolt: [성능 개선] String.format 기반 hex 변환을 HexFormat.of().formatHex()로 대체#60seonghobae wants to merge 1 commit into
Conversation
DefaultDocumentConversionService.java에서 byte array를 hex string으로 변환하는 과정의 성능 병목을 해결합니다.
루프 내에서 String.format("%02x", b)를 반복 호출하는 방식은 많은 메모리 할당과 오버헤드를 발생시킵니다.
이를 Java 내장 API인 java.util.HexFormat.of().formatHex(raw)를 사용하도록 변경하여 처리 속도를 높이고 메모리 사용량을 줄입니다.
관련 학습 내용은 .jules/bolt.md 에 기록하였습니다.
|
👋 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. |
|
중복 정리: 이 PR은 'HexFormat hex 변환 최적화' 클러스터의 중복입니다. 정본으로 #80 (APPROVED + CI green + MERGEABLE)을 유지합니다. 동일 파일을 수정해 동시 병합이 불가능하므로 정리합니다. 고유하게 필요한 변경이 있으면 #80에 반영하거나 재오픈하세요. |
💡 무엇을: DefaultDocumentConversionService.java의
contentHash메서드에서 수행하는 byte array의 hex string 변환 로직을 수정했습니다. 기존 반복문을 통한String.format호출을 Java 내장java.util.HexFormat.of().formatHex(raw)를 사용하도록 대체했습니다.🎯 왜: 루프 내부에서
String.format을 호출하면 매번 새로운 문자열과 포매터 객체가 생성되어 메모리 할당 및 가비지 컬렉션(GC) 오버헤드가 발생하여 성능 병목이 생기기 때문입니다.📊 영향: 반복적인 객체 생성을 제거하여, 메모리 사용량을 줄이고 CPU 오버헤드를 크게 감소시킵니다.
🔬 검증 방법: 코드 리뷰 및
mvn test를 통해 기능이 기존과 동일하게 올바르게 동작하는지, 성능 최적화 패턴에 맞게 수정되었는지 확인하였습니다. .jules/bolt.md 파일에서 성능 개선 패턴(anti-pattern)에 대한 학습 내용이 기록되었습니다.PR created automatically by Jules for task 16465941553572456360 started by @seonghobae