Open zxdong262 opened 1 week ago
I am working on version 2.0 which is a complete rewrite. I will check this issue later.
With version 1.x there are some workarounds. For example, before you manage
an obj
, you may iterate all of Object.values(obj)
and exclude
all non-primitive props. Then the result is the same as only monitor the top level changes.
In your example:
import { exclude } from 'manate';
const testData = generateTestData(size)
exclude(testData);
...
In your test cases, you seem to invoke manage
again and again on the same data, which is very uncommon. In reality, most people only manage
once, and play with the managed object afterwards.
It is a known limitation that setup the managed object is expensive.
But again, I am working on version 2.0. You are welcome to test it again.
As the benchmark shows, use json string as state would beat directly use large array in read.
Result: