Repository navigation
perf(ui): build DOM nodes 3–4x faster #149
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
+63
−16
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
634da0a
perf(ui): put node type constants on the prototype
natemoo-re 757008a
perf(ui): reflect attribute properties only once the map is exposed
natemoo-re 3b94899
perf(ui): case-map ascii-only names natively
natemoo-re 7908a8f
perf(ui): push appended children instead of splicing
natemoo-re fe7d37e
chore: add changeset for faster node construction
natemoo-re 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 @@ | ||
| --- | ||
| '@clack/ui': patch | ||
| --- | ||
|
|
||
| Improves the speed of building DOM nodes with `createElement` by about three times |
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,7 +1,10 @@ | ||
| // The native case maps agree with the ASCII ones on ASCII-only strings and are much faster. | ||
| const NON_ASCII = /[^\0-\x7f]/; | ||
|
|
||
| export function asciiLowercase(s: string): string { | ||
| return s.replace(/[A-Z]/g, (c) => c.toLowerCase()); | ||
| return NON_ASCII.test(s) ? s.replace(/[A-Z]/g, (c) => c.toLowerCase()) : s.toLowerCase(); | ||
| } | ||
|
|
||
| export function asciiUppercase(s: string): string { | ||
| return s.replace(/[a-z]/g, (c) => c.toUpperCase()); | ||
| return NON_ASCII.test(s) ? s.replace(/[a-z]/g, (c) => c.toUpperCase()) : s.toUpperCase(); | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.