-
Notifications
You must be signed in to change notification settings - Fork 780
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
Use node.append(child) instead of node.appendChild(child) #1037
base: main
Are you sure you want to change the base?
Conversation
Possibly. I'll spend some time on this and find out. I do see some potential around Lines 105 to 110 in 9df1aca
Lines 117 to 123 in 9df1aca
But I need to wrap my head around it. High noon for me to try to understand all inner workings of Hyperapp's core. (Code comments would help, but are non-existent. Are you planning on documenting the core?) |
What do you need help with? |
Well, I need to walk through the code and see what happens. Never bothered to fully understand the concept of patching. |
It would seem to me that here, as with #1036 the more generic function is likely to be less performant. At the least, it must inspect argument types and branch, whereas the dedicated function for Nodes expects a Node. |
The performance difference really is neglible IMO. See https://www.measurethat.net/Benchmarks/Show/9176/0/js-append-vs-appendchild |
@skanne performance difference is about 12%, which is not critical for custom usage, but not for hyperapp(superfine) |
Hi Jorge,
similar to PR 1036 I suggest replacing
node.appendChild(child)
withnode.append(child)
. Difference explained here: https://dev.to/ibn_abubakre/append-vs-appendchild-a4m.Benefit: 5 characters/bytes of code less.
Regards,
Sven