-
Notifications
You must be signed in to change notification settings - Fork 1
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
Review performance impact vs react-from-markup #7
Comments
Time to process 10,000 rehydrations:
Just ran it as a test in jest: it("Performance", async () => {
const componentName: string = "myComponent";
const rehydrator = async () => {
return React.createElement("span", {}, "rehydrated component");
};
const rehydrators = { [componentName]: rehydrator };
const fn = async () => {
const documentElement = document.createElement("div");
documentElement.innerHTML = `<div data-rehydratable="${componentName}"></div>`;
await reactFromMarkupContainer(documentElement, rehydrators, {
extra: {},
});
};
const iterations = 10000;
console.time("Function #1");
for (let i = 0; i < iterations; i++) {
fn();
}
console.timeEnd("Function #1");
}); |
Re-test using variation of above jest snippet. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#3, #4 and #6 introduce various changes that are likely to impact performance.
Should review:
for
loop)find
).matches(options.compoundSelector)
instead of.hasAttribute
Rather than reviewing each item, it might be worth smoke testing react-from-html and react-from-markup to get an "ops / second (higher is better)" type comparison.
The text was updated successfully, but these errors were encountered: