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

Bottleneck on large objects #519

Closed
joelbqz opened this issue Aug 13, 2022 · 5 comments · Fixed by #520 or #664
Closed

Bottleneck on large objects #519

joelbqz opened this issue Aug 13, 2022 · 5 comments · Fixed by #520 or #664
Assignees
Labels
enhancement New feature or request

Comments

@joelbqz
Copy link

joelbqz commented Aug 13, 2022

Hello @dai-shi I made an experiment of having 5000 form fields with different state managers and found out that Valtio isn't performing well:

Jotai
https://codesandbox.io/s/form-test-jotai-05chcf?file=/src/App.tsx

Zustand
https://codesandbox.io/s/form-test-zustand-u53m0s

Valtio(increase SIZE to 5000)
https://codesandbox.io/s/form-test-valtio-b61ldg

@joelbqz joelbqz changed the title Performance Performance Aug 13, 2022
@joelbqz joelbqz changed the title Performance Bottleneck on large objects Aug 13, 2022
@dai-shi
Copy link
Member

dai-shi commented Aug 13, 2022

Thanks for reporting!
There seems nothing wrong in the usage. Something must be wrong on the library end.
(A bit surprising that nobody has reported this in the past. 😅 )

@dai-shi dai-shi added the enhancement New feature or request label Aug 13, 2022
@dai-shi dai-shi self-assigned this Aug 13, 2022
@dai-shi
Copy link
Member

dai-shi commented Aug 13, 2022

Looks like createProxyToCompare is slow.

return createProxyToCompare(currSnapshot, currAffected, proxyCache)

And, it probably happens with valtio only (not with react-tracked) because valtio snapshot is always frozen.

@dai-shi
Copy link
Member

dai-shi commented Aug 13, 2022

Fixed! https://codesandbox.io/s/form-test-valtio-fgz47b

@joelbqz
Copy link
Author

joelbqz commented Aug 13, 2022

that was fast ⚡ Great work

@dai-shi
Copy link
Member

dai-shi commented Feb 13, 2023

This issue is back again in v1.10.1 by #656.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants