-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
performance issue related to lodash/isEqual function #4291
Comments
I already have changed all isEqual occurrences in the RJSF igorbrasileiro@274a0a5. Can I apply this improvement? |
I did a test running the playground locally with a bigger schema and big formdata and had 20% improvement. Others tests could be done Steps to test:
version with fast-deep-equal: https://github.com/igorbrasileiro/react-jsonschema-form. This problem starts to be more serious when you have realtime forms with schema or data changes. Results: |
@igorbrasileiro We have one concern about the Also, we noticed that we are using Please submit the PR for our consideration. Thanks for the good work. |
Ok, I will open a PR considering everything you mentioned. Thank you for the explanation too |
Hi @heath-freenome, thank you for the suggestion! Unfortunately, we can't replace function deepEquals(a: any, b: any): boolean {
return isEqualWith(a, b, (obj: any, other: any) => {
if (typeof obj === "function" && typeof other === "function") {
// Assume all functions are equivalent
// see https://github.com/rjsf-team/react-jsonschema-form/issues/255
return true;
}
return fastDeepEqual(obj, other); // fallback to default isEquals behavior
});
}
console.log(deepEquals({ foo: { bar() {} } }, { foo: { bar() {} } })) // false Given this limitation, I suggest we keep the current |
@heath-freenome I found a faster package that works with a custom comparator, to allow compare functions https://github.com/planttheidea/fast-equals. Can you give your considerations about it? Same benchmark I did above (gist), but with the fast-equal as baseline |
@heath-freenome should reopen this issue? |
Prerequisites
What theme are you using?
core
Version
5.x
Current Behavior
No response
Expected Behavior
No response
Steps To Reproduce
the Gist was made with deno bench, but can be done with other js runtime.
Environment
Anything else?
The results of the benchmark, in all three cases, the fast-deep-equal is better than lodash/isEqual
The text was updated successfully, but these errors were encountered: