You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My guess having unpredictable object keys forces V8 to use less efficient internal structures for object representation.
Maybe using a Map internally can solve an issue. Although, exposing it externally would be a breaking change.
Expected result
If we provide predictable id in spawnChild, starting and stopping the system is fast.
XState version
XState version 5
Description
Stopping a system with lots of children with non-sequential/unpredicatable ids is slow.
Consider a following system
....
Starting and stopping such a systems takes way more time than a system with predictable ids like
0
,1
,2
...It probably comes down to this line.
xstate/packages/core/src/actions/stopChild.ts
Line 45 in cbec1a5
My guess having unpredictable object keys forces V8 to use less efficient internal structures for object representation.
Maybe using a
Map
internally can solve an issue. Although, exposing it externally would be a breaking change.Expected result
If we provide predictable
id
in spawnChild, starting and stopping the system is fast.no_id_provided_in_spawn.mov
Actual result
If we provide a random
id
, starting and stopping the system takes about 1 second on M3 mac without CPU slowdown.uuid_provided_in_spawn.mov
Reproduction
https://stackblitz.com/edit/vitejs-vite-y3j896?file=src%2FApp.jsx
Additional context
No response
The text was updated successfully, but these errors were encountered: