-
Notifications
You must be signed in to change notification settings - Fork 0
⚡ Bolt: 문자열 조합 성능 최적화 #486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
seonghobae
wants to merge
1
commit into
develop
from
perf/bolt-inline-ternary-concat-7840970232668382417
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,4 @@ | ||
| ## 💡 What: | ||
| `app.js`에서 O(N)으로 동작하던 배열 검색(`findIndex`, `find`)을 O(1) 시간 복잡도를 가진 Map 캐시(`taskIdToIndexCache`) 조회로 최적화했습니다. O(1) 조회를 수행하기 위해 지연 초기화(lazy initialization)되는 캐시를 구축하고, `state.tasks` 배열의 구조적 변경(삽입, 삭제, 순서 변경 등)이 일어나는 모든 지점에서 캐시를 무효화하여(`invalidateTaskIndexCache()`) 데이터 무결성을 보장했습니다. | ||
|
|
||
| ## 🎯 Why: | ||
| 트리 구조의 특성 상, 자식 탐색이나 계층 구조 재조정을 위해 `getLastDescendantId`, `getTaskSubtreeRange` 등의 헬퍼 함수가 빈번하게 호출됩니다. 해당 함수들 내부에서 매번 `findIndex`를 사용하여 선형 탐색을 수행하면 태스크가 많아질수록 UI가 멈추거나 병목 현상이 발생할 수 있습니다. 이를 해결하여 대규모 데이터에서도 원활하고 빠른 성능을 유지하기 위함입니다. | ||
|
|
||
| ## 📊 Measured Improvement: | ||
| 약 10,000개의 태스크로 구성된 계층적 데이터를 임의 생성하여 Node.js 환경에서 성능 측정을 수행한 결과는 다음과 같습니다 (반복 10,000회 수행 기준): | ||
|
|
||
| * **최적화 전 (Baseline):** | ||
| * `getLastDescendantId`: ~1189 ms 소요 | ||
| * `getTaskSubtreeRange`: ~1224 ms 소요 | ||
| * **최적화 후 (Optimized):** | ||
| * `getLastDescendantId`: ~5 ms 소요 | ||
| * `getTaskSubtreeRange`: ~5 ms 소요 | ||
|
|
||
| 캐시를 도입하여 배열 선형 탐색의 병목을 완벽히 해소하였으며, E2E 테스트(Playwright)를 통해 기능의 부수 효과(side effects)가 없음을 확인했습니다. | ||
| 💡 What: 문자열 조합 성능 최적화 (String.padStart()를 인라인 3항 연산자로 대체) | ||
| 🎯 Why: 날짜 포매터와 같이 자주 호출되는 핫 루프에서 String.padStart()를 사용할 때 발생하는 불필요한 문자열 할당과 JS-C++ 변환 오버헤드를 줄이기 위함입니다. | ||
| 📊 Impact: 핫 루프에서의 문자열 포매팅 성능 향상 및 메모리 할당 감소 | ||
| 🔬 Measurement: 단위 테스트 및 e2e 테스트를 통과하며, 날짜 관련 데이터가 정상적으로 포맷팅되는지 확인 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: ContextualWisdomLab/scopeweave
Length of output: 15664
🏁 Script executed:
Repository: ContextualWisdomLab/scopeweave
Length of output: 8696
성능 주장을 동일한 측정 기준으로 뒷받침하세요.
app.js#L2685-L2701: 지원 브라우저, 엔진 버전, 입력 범위, 반복 횟수,padStart()대비 측정 결과를 추가하거나 할당 감소 및 JS-to-C++ 오버헤드 주장을 삭제하세요..jules/bolt.md#L7-L9: 측정한 엔진과 입력 범위로 학습 지침의 적용 범위를 제한하세요.pr_desc.md#L1-L4: 재현 가능한 성능 결과를Measurement에 추가하세요. 결과가 없으면Validation으로 변경하고 정확성 검증만 기술하세요.📍 Affects 3 files
app.js#L2685-L2691(this comment).jules/bolt.md#L7-L9pr_desc.md#L1-L4🤖 Prompt for AI Agents