Skip to content

⚡ Bolt: [Replace String.format with HexFormat]#101

Closed
seonghobae wants to merge 1 commit into
mainfrom
perf-hexformat-17534874800505539451
Closed

⚡ Bolt: [Replace String.format with HexFormat]#101
seonghobae wants to merge 1 commit into
mainfrom
perf-hexformat-17534874800505539451

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

💡 변경 사항

String.format("%02x", b)를 반복문에서 호출하는 코드를 제거하고, 사전에 초기화된 불변 인스턴스인 HexFormat을 사용하여 원시 바이트 배열을 한 번에 16진수 문자열로 변환하도록 수정했습니다.

🎯 문제점

루프 내부의 String.format 사용은 구문 분석 비용과 중간 문자열/객체 할당으로 인해 성능 병목 현상을 유발하는 알려진 안티 패턴입니다.

📊 기대 효과

  • 성능 개선: 중간 객체 생성이 생략되며 변환 속도가 현저히 빨라집니다. 문자열 변환 및 파싱에 소요되는 오버헤드가 절감됩니다.

🔬 검증 방법

  • mvn test를 사용하여 모든 테스트 (DefaultDocumentConversionServiceTest, ArtifactLinkServiceTest 등)가 정상적으로 통과하는지 확인했습니다.
  • mvn org.jacoco:jacoco-maven-plugin:prepare-agent test org.jacoco:jacoco-maven-plugin:report를 실행하여 100% 코드 커버리지가 유지됨을 검증했습니다.

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

반복문 내에서 `String.format`을 사용하여 16진수 문자열을 생성하는 것은 구문 분석 및 중간 객체 생성으로 인해 성능 저하를 유발합니다. 이를 Java 17+의 표준인 불변 및 스레드 안전 `java.util.HexFormat`을 사용하도록 변경하여 성능을 최적화하고 중간 객체 할당을 제거했습니다.

영향:
- `DefaultDocumentConversionService.contentHash()` 및 `ArtifactLinkService.sha256Hex()`에서 문자열 생성 비용 감소
- 객체 생성 감소 및 불필요한 가비지 컬렉터 부하 방지
@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.

@seonghobae

Copy link
Copy Markdown
Collaborator Author

중복 정리: 이 PR은 'HexFormat hex 변환 최적화' 클러스터의 중복입니다. 정본으로 #80 (APPROVED + CI green + MERGEABLE)을 유지합니다. 동일 파일을 수정해 동시 병합이 불가능하므로 정리합니다. 고유하게 필요한 변경이 있으면 #80에 반영하거나 재오픈하세요.

@seonghobae seonghobae closed this Jul 7, 2026
@google-labs-jules

Copy link
Copy Markdown

중복 정리: 이 PR은 'HexFormat hex 변환 최적화' 클러스터의 중복입니다. 정본으로 #80 (APPROVED + CI green + MERGEABLE)을 유지합니다. 동일 파일을 수정해 동시 병합이 불가능하므로 정리합니다. 고유하게 필요한 변경이 있으면 #80에 반영하거나 재오픈하세요.

Understood. Acknowledging that this PR is a duplicate and work on this task is now complete as the canonical PR #80 is being kept.

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