-
Notifications
You must be signed in to change notification settings - Fork 0
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
Benchmark for WP directives #1
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: Mario Santos <[email protected]>
Could you please elaborate more on this? Preact is keyed, so we should be able to use their So, I guess this return list.map((item) => (
<mainContext.Provider
value={[{ ...context, [name]: item }, setContext]}
key={item[key]}
>
{element.props.children}
</mainContext.Provider>
)); |
Yes, you are right; I was about to clarify that. The reason the WP directives framework ends in the "non-keyed" category is because of an issue with our implementation. I've already replaced EDIT: I used the question marks (¿?) because I was confused as well, haha. 😅 🤷 |
Ok, thanks David! |
Uhm, it was that bug using |
Preliminary resultsThe following picture showcases WP directives' current performance results (at 01e565c) compared with Preact and Alpine. Our framework is expected to fall between both, but we can see that it performs poorly in some tasks, like "select row", and appears in last place. The current |
I've opened a bug in Preact's repo: |
The issue is fixed and should be available once Preact releases a new version: |
What?
Add a benchmark to measure WP directives' performance. ⏱️
Why?
This PR aims to provide a tool for measuring the WP directives' performance while we iterate over their API and potential implementation. We can also compare WP directives with other frameworks or even different implementations (e.g., using
useState
, preact signals, etc.).How?
To start, I've copied the directives from WordPress/gutenberg#44509, which is the experiment that contains the latest features at this moment (directives & components, processed during both parsing and client execution).
I had to modify the implementation to avoid using
deepSignals
(this), as it seems not to fully work as expected yet.Also, I've implemented a missing
wp-for
directive to dynamically render a list of items inside a table (similar to Alpine'sx-for
directive). This directive still has room for improvement regarding performance.Results