pointfreeco / swift-case-paths

🧰 Case paths extends the key path hierarchy to enum cases.
https://www.pointfree.co/collections/enums-and-structs/case-paths
MIT License
904 stars 105 forks source link

Performance: Access case path directly in dynamic member lookup #137

Closed stephencelis closed 8 months ago

stephencelis commented 8 months ago

Case key paths are slightly expensive to resolve since they need to create a Case value under the hood, and apply a dynamic key path to it to build up something composed. Because dynamic member lookup only ever cares about one component at a time, we can bypass this extra work and access the case path directly.