feat(jsx/dom): improve performance of findInsertBefore#3203
Closed
ryuapp wants to merge 1 commit intohonojs:mainfrom
Closed
feat(jsx/dom): improve performance of findInsertBefore#3203ryuapp wants to merge 1 commit intohonojs:mainfrom
findInsertBefore#3203ryuapp wants to merge 1 commit intohonojs:mainfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3203 +/- ##
=======================================
Coverage 96.20% 96.20%
=======================================
Files 151 151
Lines 15074 15081 +7
Branches 2718 2647 -71
=======================================
+ Hits 14502 14509 +7
Misses 572 572 ☔ View full report in Codecov by Sentry. |
Member
|
Hi @ryuapp, Thank you for doing the research. I appreciate your work. There is potential for performance improvement by stopping recursive calls. However, the essential cause of #3201 seems to be elsewhere. I will create a PR after this, but it will likely be a fix. diff --git a/src/jsx/dom/render.ts b/src/jsx/dom/render.ts
index dbb8478b..6b18f2ae 100644
--- a/src/jsx/dom/render.ts
+++ b/src/jsx/dom/render.ts
@@ -279,7 +279,7 @@ const findInsertBefore = (node: Node | undefined): SupportedElement | Text | nul
return node.e
}
- if (node.vC) {
+ if (node.vC && node.pP) {
for (let i = 0, len = node.vC.length; i < len; i++) {
const e = findInsertBefore(node.vC[i])
if (e) {
|
Contributor
Author
Member
|
@ryuapp Thanks! |
3 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix #3201
I honestly don't know much about it, but eliminating recursive calls improves performance.
We may need accurate benchmarks or tests.
I tried with the following example:
https://github.com/ryuapp/hono-vite-template
At least increasing the issue example didn't slow it down.
The author should do the following, if applicable
bun run format:fix && bun run lint:fixto format the code