Skip to content

⚡ Bolt: urlEncodePath() 성능 최적화 (문자열 할당 오버헤드 제거)#116

Open
seonghobae wants to merge 3 commits into
masterfrom
bolt/optimize-url-encode-11250359961745319240
Open

⚡ Bolt: urlEncodePath() 성능 최적화 (문자열 할당 오버헤드 제거)#116
seonghobae wants to merge 3 commits into
masterfrom
bolt/optimize-url-encode-11250359961745319240

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

💡 What: urlEncodePath() 함수에서 루프 내 byte.toString(16).padStart(2, '0').toUpperCase()를 사용해 16진수로 변환하던 로직을 비트 시프트 연산과 배열 조회를 활용한 방식으로 교체했습니다. 또한, 인코딩할 필요가 없을 때는 StringBuilder 생성을 건너뛰도록 최적화했습니다.
🎯 Why: URL 인코딩 과정에서 바이트마다 3개의 문자열(원본 문자열, 패딩된 문자열, 대문자 문자열)이 할당되어 대량의 가비지 컬렉션(GC) 오버헤드를 발생시키고 있었기 때문입니다.
📊 Impact: 인코딩 작업 시 바이트당 문자열 할당을 완전히 제거하여 실행 속도 향상 및 메모리 사용량을 대폭 절감했습니다.
🔬 Measurement: JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 ./gradlew test를 통해 기존 테스트 스위트가 여전히 100% 성공하는지 확인할 수 있습니다.


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

루프 내에서 `byte.toString(16).padStart(2, '0').toUpperCase()`를 사용할 때 발생하는 불필요한 다중 중간 문자열 객체 할당을 방지하기 위해, 비트 연산 및 미리 정의된 16진수 문자 배열을 사용하여 `urlEncodePath()`의 인코딩 성능을 개선했습니다. 또한 인코딩이 필요 없는 문자열에 대해서는 `StringBuilder`를 초기화하지 않도록 지연 할당을 적용했습니다.
@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.

루프 내에서 `byte.toString(16).padStart(2, '0').toUpperCase()`를 사용할 때 발생하는 불필요한 다중 중간 문자열 객체 할당을 방지하기 위해, 비트 연산 및 미리 정의된 16진수 문자 배열을 사용하여 `urlEncodePath()`의 인코딩 성능을 개선했습니다. 또한 인코딩이 필요 없는 문자열에 대해서는 `StringBuilder`를 초기화하지 않도록 지연 할당을 적용했습니다.
루프 내에서 `byte.toString(16).padStart(2, '0').toUpperCase()`를 사용할 때 발생하는 불필요한 다중 중간 문자열 객체 할당을 방지하기 위해, 비트 연산 및 미리 정의된 16진수 문자 배열을 사용하여 `urlEncodePath()`의 인코딩 성능을 개선했습니다. 또한 인코딩이 필요 없는 문자열에 대해서는 `StringBuilder`를 초기화하지 않도록 지연 할당을 적용했습니다.
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