Skip to content
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

Runtime performance improvement #188

Open
Machy8 opened this issue Jan 30, 2023 · 2 comments
Open

Runtime performance improvement #188

Machy8 opened this issue Jan 30, 2023 · 2 comments
Labels
🧹 Maintanance Tunning that is not a feature @stylify/stylify Targeting @stylify/stylify package
Milestone

Comments

@Machy8
Copy link
Member

Machy8 commented Jan 30, 2023

Describe the problem

Caching: The compile() method of the Compiler class is called multiple times, which can be time-consuming. Caching might improve performance.

Reducing DOM operations: The updateCss() should be called on requestAnimationFrame() to batch the changes and update the CSS in a single pass.

Using getElementyByClassName instead of querySelectorAll()

Use of const instead of let and var: it helps avoid re-declarations and re-assignments.

Redraws only when css changed : call callHook() method in the updateCss() method, only call it when the css has been changed.

Inner html vs outerHtml: Use of innerHTML or textContent instead of outerHTML when updating the DOM.

Unused code: Check out for unused initMutationObserver()

Describe the proposed solution

.

Alternatives considered

.

Importance

nice to have

@Machy8 Machy8 added @stylify/stylify Targeting @stylify/stylify package 🧹 Maintanance Tunning that is not a feature labels Jan 30, 2023
@Machy8 Machy8 added this to the 1,0.x milestone Feb 18, 2023
@MilesPernicious
Copy link
Contributor

Ah I didn't see this issue when making my PR #226 226. I can try tackling this if you like!

@Machy8
Copy link
Member Author

Machy8 commented Mar 19, 2023

Sure, if you want, you can take any point you want (or even any other if you find something you want to improve). I will connect all those PR with this issue. I have planned to solve this issue slowly after releasing the 1.0 version, so there will be no conflicts between our branches as I am not focusing on Runtime now.

Some of those points are not explained well enough though, because it's just a scratch of what I had in my head when I was browsing the Runtime. So feel free to improve literally anything you want :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧹 Maintanance Tunning that is not a feature @stylify/stylify Targeting @stylify/stylify package
Projects
None yet
Development

No branches or pull requests

2 participants