max-mapper / max-mapper/yo-yo

"pure" components

Open
#35 9 comments 2 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

I'm not sure how much of this is within morphdom, hyperx or bel.

How do these modules handle multiple updates to a large dom heirarchy when very little changes? Does morphdom do any simple === comparisons of nodes? If so can we make rendering more efficient by memoizing returned values? e.g. experimenting with yo-yo so far I am writing quite a lot of:

function MyComponent(props) {
  return yo`<div>${props.name}</div>`
}

And all this is composed into a complete page. If yo/bel/hyperx could memoize the returned values for each input of strings and values, then morphdom could do a simple === and save time maybe?

Maybe this is happening already? One potential case is animations - I want to yo.update() the entire page 60 times a second with new values being passed down through the render heirarchy. Most pieces/components of the page don't actually use values, but my understanding is that currently each time a new DOM element would be built, and morphdom would do a deep compare?

Would this be a significant saving? I'm thinking how to reduce both the cost of unnecessary calls of bel.createElement and unnecessary diff calculations.

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

Start by reading the issue's referenced yo.update(), bel.createElement, morphdom, hyperx, and bel behavior, then compare how repeated updates traverse unchanged components. The issue does not name files or tests; done would require a decided scope and evidence that memoizing returned values or skipping unchanged work improves the stated update path.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.