-
Notifications
You must be signed in to change notification settings - Fork 0
⚡ Bolt: [performance improvement] String.padStart 인라인 대체로 날짜 포매팅 핫루프 최적화 #656
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
Draft
seonghobae
wants to merge
9
commits into
develop
Choose a base branch
from
bolt-optimize-date-formatters-10394720597022587114
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
542a7ae
⚡ Bolt: [performance improvement] 핫루프에서 String.padStart 할당 제거
seonghobae 06af5c7
docs(perf): make date formatter evidence measurement-bound
seonghobae 3435813
test(dates): lock formatter semantics across zero padding
seonghobae 552c7af
test(dates): run formatter regression in unit and coverage suites
seonghobae 5f98f06
⚡ Bolt: [performance improvement] 핫루프에서 String.padStart 할당 제거
seonghobae 002cb80
test: restore date formatter behavior coverage with line mapping
seonghobae ee1a4cb
test: wire date formatter regression into unit and coverage suites
seonghobae 757c411
docs: bound date formatter performance guidance to measured evidence
seonghobae e9fe153
⚡ Bolt: [performance improvement] 핫루프에서 String.padStart 할당 제거
seonghobae 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
Some comments aren't visible on the classic Files Changed page.
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 |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import assert from 'node:assert/strict'; | ||
| import { readFileSync } from 'node:fs'; | ||
| import { resolve } from 'node:path'; | ||
| import vm from 'node:vm'; | ||
|
|
||
| const appPath = resolve('app.js'); | ||
| const appSource = readFileSync(appPath, 'utf8'); | ||
|
|
||
| function loadFunction(name) { | ||
| const marker = `function ${name}(`; | ||
| const start = appSource.indexOf(marker); | ||
| assert.notEqual(start, -1, `${name} must remain defined in app.js`); | ||
|
|
||
| let depth = 0; | ||
| let opened = false; | ||
| let end = -1; | ||
| for (let index = appSource.indexOf('{', start); index < appSource.length; index += 1) { | ||
| if (appSource[index] === '{') { | ||
| depth += 1; | ||
| opened = true; | ||
| } else if (appSource[index] === '}') { | ||
| depth -= 1; | ||
| if (opened && depth === 0) { | ||
| end = index + 1; | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| assert.notEqual(end, -1, `${name} must have a complete function body`); | ||
|
|
||
| const source = appSource.slice(start, end); | ||
| const lineOffset = appSource.slice(0, start).split('\n').length - 1; | ||
| return new vm.Script(`(${source})`, { | ||
| filename: appPath, | ||
| lineOffset, | ||
| }).runInThisContext(); | ||
| } | ||
|
|
||
| const formatDateInput = loadFunction('formatDateInput'); | ||
| const formatLocalDateInput = loadFunction('formatLocalDateInput'); | ||
| const formatCompactDate = loadFunction('formatCompactDate'); | ||
|
|
||
| assert.equal(formatDateInput(new Date(Date.UTC(2026, 0, 5))), '2026-01-05'); | ||
| assert.equal(formatDateInput(new Date(Date.UTC(2026, 10, 15))), '2026-11-15'); | ||
|
|
||
| assert.equal(formatLocalDateInput(new Date(2026, 0, 5, 12, 0, 0)), '2026-01-05'); | ||
| assert.equal(formatLocalDateInput(new Date(2026, 10, 15, 12, 0, 0)), '2026-11-15'); | ||
| assert.equal(formatCompactDate(new Date(2026, 0, 5, 12, 0, 0)), '20260105'); | ||
| assert.equal(formatCompactDate(new Date(2026, 10, 15, 12, 0, 0)), '20261115'); | ||
|
|
||
| const invalid = new Date(Number.NaN); | ||
| assert.equal(formatDateInput(invalid), 'NaN-NaN-NaN'); | ||
| assert.equal(formatLocalDateInput(invalid), 'NaN-NaN-NaN'); | ||
| assert.equal(formatCompactDate(invalid), 'NaNNaNNaN'); | ||
|
|
||
| console.log('date formatter tests passed'); |
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.
Uh oh!
There was an error while loading. Please reload this page.