Originally posted by **mihaho** October 13, 2021
I am facing some issues when trying to upgrade from Composable Architecture v20 to a higher version. The problem is that the CPU starts spiking after the introduction of the Identified Collections package. I profiled the app and noticed that the largest stack trace was due to the equality checks. This drew my attention to the equality conformance of `IdentifiedArray`. The difference with the old version is that you now use _[elementsEqual](https://github.com/apple/swift/blob/main/stdlib/public/core/SequenceAlgorithms.swift#L318-L336)_ instead of _[==](https://github.com/apple/swift/blob/main/stdlib/public/core/Array.swift#L1728-L1752)_. I checked the difference in Swift's source code. _elementsEqual_ always creates 2 iterators for each sequence and goes through all elements while _==_ has some shortcuts.
Replacing `lhs.elementsEqual(rhs)` with `lhs.elements == rhs.elements` helps a lot. The app becomes responsive again and the CPU drops for about ~50%
Is _elementsEqual_ needed? Any comments are welcome
Discussed in https://github.com/pointfreeco/swift-identified-collections/discussions/28