Use node.append(child) instead of node.appendChild(child)#1037
Use node.append(child) instead of node.appendChild(child)#1037skanne wants to merge 1 commit intojorgebucaran:mainfrom
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