-
Notifications
You must be signed in to change notification settings - Fork 0
⚡ Bolt: [performance improvement] 날짜 포맷터 오버헤드 최적화 및 모듈 preload 개선 #595
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2682,22 +2682,32 @@ function clamp(value, min, max) { | |
| return Math.min(max, Math.max(min, value)); | ||
| } | ||
|
|
||
| // Bolt: 성능 최적화를 위해 String.padStart() 대신 삼항 연산자를 사용한 인라인 문자열 연결 방식으로 개선했습니다. | ||
| // 이는 핫 루프에서 불필요한 문자열 할당과 JS-C++ 간의 오버헤드를 방지하여 성능을 높입니다. | ||
| function formatDateInput(date) { | ||
| const year = date.getUTCFullYear(); | ||
| const month = String(date.getUTCMonth() + 1).padStart(2, '0'); | ||
| const day = String(date.getUTCDate()).padStart(2, '0'); | ||
| const m = date.getUTCMonth() + 1; | ||
| const d = date.getUTCDate(); | ||
| const month = m < 10 ? '0' + m : m; | ||
| const day = d < 10 ? '0' + d : d; | ||
| return `${year}-${month}-${day}`; | ||
| } | ||
|
|
||
| function formatLocalDateInput(date) { | ||
| const year = date.getFullYear(); | ||
| const month = String(date.getMonth() + 1).padStart(2, '0'); | ||
| const day = String(date.getDate()).padStart(2, '0'); | ||
| const m = date.getMonth() + 1; | ||
| const d = date.getDate(); | ||
| const month = m < 10 ? '0' + m : m; | ||
| const day = d < 10 ? '0' + d : d; | ||
| return `${year}-${month}-${day}`; | ||
| } | ||
|
|
||
| function formatCompactDate(date) { | ||
| return `${date.getFullYear()}${String(date.getMonth() + 1).padStart(2, '0')}${String(date.getDate()).padStart(2, '0')}`; | ||
| const m = date.getMonth() + 1; | ||
| const d = date.getDate(); | ||
| const month = m < 10 ? '0' + m : m; | ||
| const day = d < 10 ? '0' + d : d; | ||
| return `${date.getFullYear()}${month}${day}`; | ||
|
Comment on lines
+2689
to
+2710
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 Info: Ternary numeric branch is output-equivalent to padStart The Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| } | ||
|
|
||
| function formatPercent(value, digits) { | ||
|
|
||
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.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
예시의 반환 타입을 문자열로 통일하세요.
Line [9]의 표현식은
m < 10일 때 문자열을 반환하고, 그 외에는 숫자m을 반환합니다. 이 예시를 재사용하면 입력값에 따라 타입이 달라질 수 있습니다. 두 분기 모두 문자열을 반환하도록m < 10 ? "0" + m : String(m)으로 기록하세요.수정 제안
📝 Committable suggestion
🤖 Prompt for AI Agents