-
-
Notifications
You must be signed in to change notification settings - Fork 158
perf(runtime): hoist the private-member guard to its call sites (pure read −15%) #8980
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a99907e
perf(runtime): hoist the private-member guard to its call sites
378d955
fix(run): resolve directory inputs to project entry (#8979)
proggeramlug c8abefe
Merge commit 'refs/tmp/pr8980' into b8980
xxxxxxxxxxxxx 2e7f3a6
chore(changelog): name the fragment for its own PR (8980, not 8978)
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| `perry run <dir>` now resolves the directory to its project entry instead of passing the directory itself into module collection. | ||
|
|
||
| An explicit directory input is treated as a project root: its `perry.toml` entry is read relative to that directory, falling back to `<dir>/src/main.ts` then `<dir>/main.ts`. Previously `perry run .` read `perry.toml` from the current working directory and handed the directory straight to module collection, which fails on Windows. | ||
|
|
||
| Fixes #8908. |
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,22 @@ | ||
| The private-member guard moved to its call sites, taking a call off every | ||
| ordinary property read and write. | ||
|
|
||
| #8970 made the private-member name test cheap but left the CALL. In a pure | ||
| property-read loop (`o[k]` with pre-built keys, no concat) that showed up as | ||
| `private_member_get_by_name` 11.4% plus `private_member_storage_name` 5.4% — | ||
| **16.8% of the loop, the largest single item** — essentially all of it call | ||
| overhead for keys that are rejected on their length before doing anything. | ||
|
|
||
| The guard is now invoked at the three call sites (the generic read entry, the | ||
| class-field read miss, and the generic write), so an ordinary property | ||
| operation makes no call into the private-member path at all. Keys that pass | ||
| the guard take exactly the original path. | ||
|
|
||
| Interleaved A/B, min-of-21 (under heavy co-tenant load, so read the ratios | ||
| rather than the absolutes): pure property read 26 → 22 ms (−15%), computed-key | ||
| read 51 → 45 ms (−12%), combined overwrite 50 → 46 ms (−8%), write unchanged. | ||
|
|
||
| Output on a private-member exercise — instance fields, `static #instances`, | ||
| private methods, private getters, `#x in obj`, subclassing, and an ordinary key | ||
| literally named `#<perry:private-member:1:x>` — is byte-identical to before the | ||
| change. Computed-key differential vs node is byte-identical. Suite 2779 passed. | ||
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
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
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.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Fix the issue-number text for markdownlint.
Line 4 starts with
#8970without a space. This triggers MD018 (no-missing-space-atx). WriteIssue#8970made...or escape the hash.🧰 Tools
🪛 markdownlint-cli2 (0.23.2)
[warning] 4-4: No space after hash on atx style heading
(MD018, no-missing-space-atx)
🤖 Prompt for AI Agents
Source: Linters/SAST tools