lominming
signal vs createStore vs createMutable performance for large objects
Goals:
1. A direct mutable vanilla-javascript-like interface to update complex objects
2. Performance for large objects
OPTION A: undefined -> set hack
Mutate object anyway, set(undefined) -> set(same_mutated_object) wrapped in batch so reactivity only kick off once?
Pros: No overhead since same object?
Cons: Hack!
OPTION B: always equals: false
Mutate object anyway, force reactivity trigger with { equals: false }
Pros: No overhead since same object?
Cons: equals false is dangerous and can easily cause infinite loop
OPTION C: createStore with produce
Pros: Most recommended
Cons: Overhead with createStore? setStore with produce is a bit clunky
OPTION D: createMutable
Pros: Most direct, least code, feels like Vue, Svelte, Vanilla Javascript
Cons: Overhead with createMutable? Not really recommended, may be deprecated in 2.0. Some bugs and hacks in implementation.
- All code in playground: https://playground.solidjs.com/anonymous/d694e908-c193-494b-ab08-c3e5676269d7
Questions:
- I know Option A and B are crazy, but is there anything actually wrong? What cases would those hacks break? Did I miss any gotchas?
- Which is best for perf? Would A and B be best since same object is used?
2 replies