Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2026-06-28 - Fast Hex String Conversion
**Learning:** Using `String.format("%02x", b)` inside a loop for converting byte arrays to hex strings is a significant performance bottleneck due to string parsing overhead per byte.
**Action:** Use `java.util.HexFormat.of().formatHex(bytes)` instead for a massive performance improvement when converting byte arrays to hex strings in Java 17+.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 변경 사항

## [Unreleased]
### 성능 개선 (Performance)
- `DefaultDocumentConversionService` 내부의 `String.format` 루프를 사용하던 비효율적인 Hex 문자열 변환 로직을 `java.util.HexFormat`을 사용하도록 변경하여 성능 크게 최적화
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,8 @@ private String contentHash(MultipartFile file) {
}

byte[] raw = digest.digest();
StringBuilder hex = new StringBuilder(raw.length * 2);
for (byte b : raw) {
hex.append(String.format("%02x", b));
}

return hex.toString();
// HexFormat is faster than String.format
return java.util.HexFormat.of().formatHex(raw);
} catch (NoSuchAlgorithmException ex) {
throw new IllegalStateException("SHA-256 digest unavailable", ex);
} catch (IOException ex) {
Expand Down
Loading