⚡ Bolt: 정규표현식 컴파일 및 문자열 빌더 최적화 적용 - #57
Conversation
- 정규표현식 매번 컴파일로 인한 병목(O(F*P))을 루프 밖 선컴파일로 최적화 (O(P)) - O(N^2) 문자열 덧셈을 StringBuilder를 사용해 O(N)으로 개선 - 제외 목록(exclude list)을 List에서 Set으로 변경하여 in 연산 O(N) -> O(1) 향상 - 100%에 근접하는 테스트 커버리지 유지 (99.6% 달성)
|
👋 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. |
💡 What:
process_ignore_file내 루프에서 정규표현식을 매번 컴파일하던 것을 루프 밖에서 한 번만 처리되도록 최적화했습니다.List<String>에서Set<String>으로 변경했습니다.index_middle함수 내부에서String += String패턴으로 작성된 O(N^2) 문자열 결합 로직을StringBuilder.append()를 사용하는 O(N) 로직으로 개선했습니다.🎯 Why:
.html4ignore)이 존재할 때 반복적인.toRegex()호출은 CPU 자원을 크게 소모합니다.exclude리스트를 조회할 때마다 순차 탐색을 하던 방식을 해시 기반 탐색으로 변경하여 속도를 극대화할 필요가 있었습니다.📊 Impact:
🔬 Measurement:
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 && ./gradlew test jacocoTestReport를 통해 최적화가 원본 기능을 훼손하지 않았음을 검증하며, JaCoCo 리포트로 커버리지(99.6%)를 확인할 수 있습니다.PR created automatically by Jules for task 13358364728556936793 started by @seonghobae