From 3760f48f7eb009d548651ffbeddd076e489f3e4d Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Wed, 16 Sep 2026 17:49:38 +0000 Subject: [PATCH 1/3] Optimize runtime_tool_slug by using native string methods instead of regex --- .jules/bolt.md | 4 ++++ scripts/ci/opencode_review_normalize_output.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.jules/bolt.md b/.jules/bolt.md index 4f20b36047..0dcd4a66fa 100644 --- a/.jules/bolt.md +++ b/.jules/bolt.md @@ -54,3 +54,7 @@ ## 2026-09-01 - 대용량 문자열 서브스트링 스캐닝 루프 최적화 **Learning:** 긴 텍스트에서 여러 기준 문자열(`candidate`)을 탐색하여 다음 구역의 시작점을 찾을 때, 텍스트 전체에 대해 반복적으로 `text.find(candidate)`를 호출하면 O(N)의 비효율적인 중복 스캐닝 오버헤드가 발생합니다. 특히 가장 가까운 시작점을 찾기 위해 모든 후보를 스캔할 때 이 문제가 심화됩니다. **Action:** 기준점(`start`)을 잡은 후, `idx = text.find(candidate, start, end)`를 사용하여 검색 범위를 동적으로 축소(`end = min(end, idx)`)하십시오. 이렇게 하면 불필요한 스캐닝 오버헤드를 막고 검색 범위를 안전하게 줄여 매우 큰 성능 향상을 얻을 수 있습니다. + +## 2025-02-12 - [간단한 공백 문자열 정규화 시 정규표현식 대신 네이티브 split/join 활용] +**Learning:** `scripts/ci/opencode_review_normalize_output.py`의 `runtime_tool_slug` 함수에서 문자열의 연속된 공백을 단일 하이픈(`-`)으로 치환할 때 `re.sub(r"\s+", "-", ...)`를 사용하면 정규표현식 컴파일 및 실행 오버헤드가 발생합니다. 단순 공백 정규화 작업에서는 Python의 네이티브 문자열 메서드인 `str.split()`과 `str.join()`을 조합하는 것이 C 수준의 속도로 동작하여 훨씬 빠릅니다. +**Action:** 단순한 공백 문자열 치환이나 정규화가 필요한 경우 정규표현식(`re.sub`) 대신 `"-".join(str.split())`과 같은 고도로 최적화된 네이티브 메서드를 우선적으로 사용하십시오. diff --git a/scripts/ci/opencode_review_normalize_output.py b/scripts/ci/opencode_review_normalize_output.py index 7ad4c2b431..a6ff3e895d 100755 --- a/scripts/ci/opencode_review_normalize_output.py +++ b/scripts/ci/opencode_review_normalize_output.py @@ -498,7 +498,8 @@ def current_changed_files() -> frozenset[str]: def runtime_tool_slug(tool_name: str) -> str: """Return the canonical receipt slug for a browser execution tool.""" - return re.sub(r"\s+", "-", tool_name.strip().casefold()) + # ⚡ Bolt: Use native string methods for whitespace normalization instead of regex + return "-".join(tool_name.casefold().split()) @lru_cache(maxsize=1) From 561129cc2557614e9e1db3e0dc8e910214156a71 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Thu, 17 Sep 2026 06:14:02 +0000 Subject: [PATCH 2/3] Optimize runtime_tool_slug by using native string methods instead of regex From 38fd75ef395906f4340c901bda3e4bfab656c03b Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Thu, 17 Sep 2026 17:03:29 +0000 Subject: [PATCH 3/3] Optimize runtime_tool_slug by using native string methods instead of regex