pmndrs / valtio

🧙 Valtio makes proxy-state simple for React and Vanilla
https://valtio.dev
MIT License
9.01k stars 251 forks source link

Performance Degradation in proxySet Instances with Increased Keys. #852

Closed kk8787 closed 7 months ago

kk8787 commented 7 months ago

Summary

Performance Degradation in proxySet Instances with Increased Keys. I checked the source code, and the performance deteriorates linearly because it performs a linear search.

Link to reproduction

When using methods such as get and set. In my environment, it becomes quite slow with over 5000 keys.

Check List

Please do not ask questions in issues.

Please include a minimal reproduction.

dai-shi commented 7 months ago

That's expected, because proxySet is just an emulation. Or, do you have any idea to improve the performance without breaking the capability? (Maybe, a tree like structure would do, but the implementation would be challenging.)