max-mapper / max-mapper/yo-yo

Discussion: Performance relating to morphdom vs virtual dom

Open
#53 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.3k
Forks
46
PR merge metrics
No merged PRs in 30d

Description

morphdom does not use a virtual DOM, it simply uses the actual DOM.

Is this better? Is it faster than using a virtual dom? I ask, because as far as I know there are costs to instantiating new DOM elements (namely, createdCallback logic when the elements are made with Custom Elements v0, and constructor logic if made with v1 API). From what I know, virtual dom does not instantiate nodes in the virtual tree, and lifecycle methods never run. It's basically just a vanilla JS object structure, then finally, once the difference are ironed out, the needed element are created (and creation logic executed).

Even if using DocumentFragments, I believe that element creation logic is still fired. f.e.

var docFrag = document.createDocumentFragment()
var el = document.createElement('my-element') // runs the element's creation logic
docFrag.appendChild(el)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named. Start by examining yo-yo's DOM-diffing implementation and compare its custom-element creation behavior with a virtual-DOM approach. Done would be a documented, benchmark-backed conclusion about the performance tradeoffs.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.