Repository navigation
⚡ Bolt: [성능 개선] #790
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
3
commits into
develop
from
bolt/skip-micro-optimization-13234336089615913866
Closed
⚡ Bolt: [성능 개선] #790
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| const BROWSER_PROGRESS_STEPS = [ | ||
| { progressLabel: "Decoding audio", progressStage: "decode", progressPercent: 20 }, | ||
| { progressLabel: "Separating stems... (45%)", progressStage: "separate", progressPercent: 45 }, | ||
| { progressLabel: "Building rehearsal cues", progressStage: "analyze", progressPercent: 70 }, | ||
| { progressLabel: "Saving reusable features", progressStage: "persist", progressPercent: 90 } | ||
| ] as const; | ||
|
|
||
| function findNextStepFind(currentPercent: number) { | ||
| return BROWSER_PROGRESS_STEPS.find((step) => step.progressPercent > currentPercent); | ||
| } | ||
|
|
||
| function findNextStepForLoop(currentPercent: number) { | ||
| for (let i = 0; i < BROWSER_PROGRESS_STEPS.length; i++) { | ||
| const step = BROWSER_PROGRESS_STEPS[i]; | ||
| if (step.progressPercent > currentPercent) { | ||
| return step; | ||
| } | ||
| } | ||
| return undefined; | ||
| } | ||
|
|
||
| const ITERATIONS = 10_000_000; | ||
|
|
||
| console.time("find"); | ||
| for (let i = 0; i < ITERATIONS; i++) { | ||
| findNextStepFind(50); | ||
| } | ||
| console.timeEnd("find"); | ||
|
|
||
| console.time("for"); | ||
| for (let i = 0; i < ITERATIONS; i++) { | ||
| findNextStepForLoop(50); | ||
| } | ||
| console.timeEnd("for"); |
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 |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| const BROWSER_PROGRESS_STEPS = [ | ||
| { progressLabel: "Decoding audio", progressStage: "decode", progressPercent: 20 }, | ||
| { progressLabel: "Separating stems... (45%)", progressStage: "separate", progressPercent: 45 }, | ||
| { progressLabel: "Building rehearsal cues", progressStage: "analyze", progressPercent: 70 }, | ||
| { progressLabel: "Saving reusable features", progressStage: "persist", progressPercent: 90 } | ||
| ] as const; | ||
|
|
||
| function findNextStepFind(currentPercent: number) { | ||
| return BROWSER_PROGRESS_STEPS.find((step) => step.progressPercent > currentPercent); | ||
| } | ||
|
|
||
| function findNextStepForLoop(currentPercent: number) { | ||
| for (let i = 0; i < BROWSER_PROGRESS_STEPS.length; i++) { | ||
| const step = BROWSER_PROGRESS_STEPS[i]; | ||
| if (step.progressPercent > currentPercent) { | ||
| return step; | ||
| } | ||
| } | ||
| return undefined; | ||
| } | ||
|
|
||
| function hardcoded(currentPercent: number) { | ||
| if (currentPercent < 20) return BROWSER_PROGRESS_STEPS[0]; | ||
| if (currentPercent < 45) return BROWSER_PROGRESS_STEPS[1]; | ||
| if (currentPercent < 70) return BROWSER_PROGRESS_STEPS[2]; | ||
| if (currentPercent < 90) return BROWSER_PROGRESS_STEPS[3]; | ||
| return undefined; | ||
| } | ||
|
|
||
| const ITERATIONS = 10_000_000; | ||
|
|
||
| console.time("find"); | ||
| for (let i = 0; i < ITERATIONS; i++) { | ||
| findNextStepFind(50); | ||
| } | ||
| console.timeEnd("find"); | ||
|
|
||
| console.time("for"); | ||
| for (let i = 0; i < ITERATIONS; i++) { | ||
| findNextStepForLoop(50); | ||
| } | ||
| console.timeEnd("for"); | ||
|
|
||
| console.time("hardcoded"); | ||
| for (let i = 0; i < ITERATIONS; i++) { | ||
| hardcoded(50); | ||
| } | ||
| console.timeEnd("hardcoded"); | ||
Oops, something went wrong.
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 | 🟠 Major | ⚡ Quick win
두 벤치마크의 측정 결과를 관찰 가능하고 대표적인 입력으로 수집하세요. 현재 호출 결과를 버리고 하나의 입력만 반복하므로 최적화 영향을 배제하지 못하고 모든 탐색 경로의 성능을 대표하지 못합니다.
benchmark2.ts#L30-L48: 세 구현의 반환값을 sink에 누적하고, 임계값 전후와>= 90입력을 워밍업 후 여러 라운드로 측정하세요.benchmark.ts#L22-L34: 두 구현의 반환값을 같은 sink에 누적하고 동일한 입력 집합과 측정 라운드를 사용하세요.📍 Affects 2 files
benchmark2.ts#L30-L48(this comment)benchmark.ts#L22-L34🤖 Prompt for AI Agents