-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Add fieldKey prop to <ArrayField> to improve performance on large arrays #4437
Conversation
Hi, and thanks for your patch. Did you measure the actual overhead of the JSON stringification? Can you provide metrics showing the improvement due to your change? |
Hi @fzaninotto I have only taken the getDataAndIds function and passed the data with and without fieldKey.
Thanks for your early reply and for this awesome project. |
Thanks, but I meant real-life usage. I have no doubt that skipping stringification is faster than using it. But my point is: on an average scenario of ArrayField usage, what's the overhead of the JSON stringification as compared to all the other JS execution? My intuition is that, unless you're using ArrayField with a very large array of very large objects, the cost of stringifying JSON isn't significant when compared to the cost of rendering. I may be wrong of course, but before we fix a potential bug, can you show me the actual bug? |
Hi, With small data the difference is insignificant compared to rendering but with 50 records total of ~643KB data here are the results. I have created a sandbox with the exact code I used. The time difference between rendering the ArrayField was [~10ms, ~30ms]and total rendering was also reduced by [~50ms, ~100ms]. The memory size is also reduced by ~1MB. |
Thanks for taking the time. That's convincing, so we'll consider merging it. But before that, you need to change the base branch to |
using JSON.stringify results with a very large key. Passing a fieldKey when available reduces the overhead Update ArrayField.tsx: Fix prettier errors Update Array.tsx: put space for prettier
Thanks! |
Thanks for docs help |
Is your feature request related to a problem? Please describe.
using JSON.stringify results with a very large key. Passing a fieldKey when available reduces the overhead