Replies: 1 comment
-
The mobx will treat it as regular array, so you will have to explicitely instruct mobx not to make it observable (
I think you can get a good picture by testing this with an observable object or Map. The most heavy lifting probably happens here: |
Beta Was this translation helpful? Give feedback.
-
I'm working on a project where I have need of a sorted array type data structure which I'm planning to implement using a balanced binary tree with order statistic (basically binary search tree with some extra info to allow accessing the n-th element). Now, I'd like to allow this structure to be accessed like a normal array which means that I'll need to create a proxy to intercept object access. As I know that mobx also uses proxies internally (when it can) to implement some of it's functionality I'm wondering if I need to be aware/careful of anything to avoid breaking mobx when I use proxies.
Also, regarding performance, I was planning to create a bunch of atoms so that, e.g., an insertion in position 500 only ends up forcing recomputation of observations that look at positions above 500. I'm wondering how worried I should be about the performance impacts of using so many atoms. Is there a good rule of thumb for how many elements each atom should manage (e.g. one atom per 10 fields or something)?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions