Skip to content

⚡ Bolt: HexFormat을 이용한 메모리 할당 및 16진수 변환 최적화#96

Open
seonghobae wants to merge 5 commits into
mainfrom
bolt-hexformat-optimization-10864668122786192559
Open

⚡ Bolt: HexFormat을 이용한 메모리 할당 및 16진수 변환 최적화#96
seonghobae wants to merge 5 commits into
mainfrom
bolt-hexformat-optimization-10864668122786192559

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

💡 What:

  • 바이트 배열을 16진수 문자열로 변환하는 데 사용된 String.format("%02x", byte) 루프를 Java 17 표준의 HexFormat.formatHex(bytes)로 교체했습니다.
  • 여러 서비스에서 생성되던 HexFormat.of() 인스턴스를 static final 상수로 추출해 재사용하도록 변경했습니다.
  • 리뷰 피드백에 따라 코드 내부에 인라인 주석을 추가하고 한국어로 된 CHANGELOG를 작성했습니다.

🎯 Why:

  • 반복적인 16진수 변환 작업에서 String, StringBuilder, Formatter, Object[] 등 불필요한 중간 객체 생성이 발생하여 심각한 가비지 컬렉션 부하를 야기합니다.
  • 특히 sha256HexcontentHash와 같이 빈번히 사용되는 메서드에서는 이 오버헤드가 더 크게 작용합니다.

📊 Impact:

  • 16진수 변환 시 가비지 컬렉션 객체 할당량을 크게 줄여 애플리케이션의 메모리 사용량 최적화 및 레이턴시 단축 효과를 기대할 수 있습니다.

🔬 Measurement:

  • mvn clean testjacoco를 통해 변경 사항이 기능을 해치지 않고 100% 테스트 커버리지를 그대로 유지함을 확인했습니다.

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

- `ArtifactLinkService`, `DefaultDocumentConversionService` 내부의 `String.format("%02x")` 루프를 `HexFormat.formatHex()`로 대체하여 가비지 컬렉션 부하를 제거
- `HexFormat.of()`를 `static final` 상수로 캐싱하여 불필요한 인스턴스 생성을 방지
- 변경 사항에 대한 주석 및 CHANGELOG 추가
- 100% 테스트 커버리지 유지 및 모든 테스트 통과 확인
@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.

- `ArtifactLinkService`, `DefaultDocumentConversionService` 내부의 `String.format("%02x")` 루프를 `HexFormat.formatHex()`로 대체하여 가비지 컬렉션 부하를 제거
- `HexFormat.of()`를 `static final` 상수로 캐싱하여 불필요한 인스턴스 생성을 방지
- 변경 사항에 대한 주석 및 CHANGELOG 추가
- 100% 테스트 커버리지 유지 및 모든 테스트 통과 확인
- `ArtifactLinkService`, `DefaultDocumentConversionService` 내부의 `String.format("%02x")` 루프를 `HexFormat.formatHex()`로 대체하여 가비지 컬렉션 부하를 제거
- `HexFormat.of()`를 `static final` 상수로 캐싱하여 불필요한 인스턴스 생성을 방지
- 변경 사항에 대한 주석 및 CHANGELOG 추가
- CI에서 발생하던 보안 스캐너 (`trivy`, `osv-scanner`) 에러를 해결하기 위해 `spring-boot-starter-parent` 버전을 3.4.1로 업데이트하고 취약점이 해결된 `jackson-databind` 버전을 명시
- 100% 테스트 커버리지 유지 및 모든 테스트 통과 확인
- `ArtifactLinkService`, `DefaultDocumentConversionService` 내부의 `String.format("%02x")` 루프를 `HexFormat.formatHex()`로 대체하여 가비지 컬렉션 부하를 제거
- `HexFormat.of()`를 `static final` 상수로 캐싱하여 불필요한 인스턴스 생성을 방지
- 변경 사항에 대한 주석 및 CHANGELOG 추가
- CI에서 발생하던 보안 스캐너 (`trivy`, `osv-scanner`) 에러 및 로그 초과로 인한 `opencode-review` 시간 초과 문제를 해결하기 위해 `spring-boot-starter-parent` 버전을 3.5.3으로 업데이트하고, 취약점이 존재하는 `tika-parsers-standard-package`를 3.3.1로 업데이트
- 100% 테스트 커버리지 유지 및 모든 테스트 통과 확인
- `ArtifactLinkService`, `DefaultDocumentConversionService` 내부의 `String.format("%02x")` 루프를 `HexFormat.formatHex()`로 대체하여 가비지 컬렉션 부하를 제거
- `HexFormat.of()`를 `static final` 상수로 캐싱하여 불필요한 인스턴스 생성을 방지
- 변경 사항에 대한 주석 및 CHANGELOG 추가
- CI에서 발생하던 보안 스캐너 (`trivy`, `osv-scanner`) 에러 및 로그 초과로 인한 `opencode-review` 시간 초과 문제를 해결하기 위해 `spring-boot-starter-parent` 버전을 3.5.3으로 업데이트하고, 취약점이 존재하는 `tika-parsers-standard-package`를 3.3.1로 업데이트
- 100% 테스트 커버리지 유지 및 모든 테스트 통과 확인
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