I was checking out the Store implementation, and saw that the
send(_:) method has a lot of
removeFirst() calls on the
bufferedActions array properties. Recently, Swift Collections was launched, with one notable new collection being a Deque. Deques offer constant-time
popFirst() operations (the graph shows performance for
prepend(_:), but IIUC the same constant-time performance can be expected for these two methods too).
The performance benefits really start to kick in once the Deque grows to more than 64 elements, which AFAIU can be expected in a moderately complex app with a large amount of actions quickly being passed into the store (such as for an action fired by an
Effect.timer, or an action connected to a
I understand that the swift-collections library hasn't hit its 1.0 release yet, but I doubt Deques
popFirst() API would change.
Would it make sense to replace those two Arrays with Deques?
I'd be happy to test it out myself – are there any standard performance tests I can turn to for TCA, with a large amount of effects fired?