-
Notifications
You must be signed in to change notification settings - Fork 23
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
Slow init #503
Comments
@quolpr can you try the same benchmarks in production builds? I remember mobx-keystone has lots of dev-only checks. Or, for example, by default it does checks for runtime types only in development, since that information is most useful in dev time. |
10k, before some optimizations
after some optimizations
I'll release the micro optimizations as 1.4.1 Expecting mobx-keystone to be as fast as plain mobx is unrealistic since mobx doesn't have patches, snapshots, a way to know the parent of an object and so on. These things take CPU and RAM. As a rule of thumb, use the best tool for the job (e.g. mobx-keystone for serializable state that needs to be undone or replicated around the network (usually document state), mobx for UI state that doesn't need any of these features). If there are many items in the document layer, then it might be an option to have them in "raw" from and feeding them to mobx-keystone when needed. |
@xaviergonz got it. Thanks! |
PS: 1.4.1 released |
Hey! I was testing mobx-keystone performance, and I am curious is there any way to optimize the speed of models creation? I made some tests here
https://codesandbox.io/s/mobx-keystone-slow-init-bcujed?file=/src/index.ts
And 100k model creation looks not so good:
![image](https://user-images.githubusercontent.com/7958527/224302222-eee83a53-e2f7-4191-af0f-e9c38b62e6c9.png)
I also made a simple mobx example, but of course, it doesn't compare with mobx-keysone itself. But it would be great to have the same performance as mobx has, like 100k creation in 300ms.
P. s.: to see real numbers, you need to open chrome devtools. CodeSandbox console is not reliable
The text was updated successfully, but these errors were encountered: