Swift 6 introduces TaskExecutors thanks to SE-0417.
As part of SE-0417, the withUnsafeCurrentTask API was extended so that users can query the unownedTaskExecutor. This is very useful in performance sensitive applications. As I'm currently building a ConnectionPool, I would love to use the returned UnownedTaskExecutor to lookup connections that are running on the executor that asks for the connection to reduce context switches.
For this it would be optimal if UnownedTaskExecutor not just implemented Equatable but also Hashable. So that I don't need to do a linear search through all potential executors and instead can use a dictionary.
Motivation
Swift 6 introduces TaskExecutors thanks to SE-0417.
As part of SE-0417, the
withUnsafeCurrentTask
API was extended so that users can query theunownedTaskExecutor
. This is very useful in performance sensitive applications. As I'm currently building a ConnectionPool, I would love to use the returnedUnownedTaskExecutor
to lookup connections that are running on the executor that asks for the connection to reduce context switches.For this it would be optimal if
UnownedTaskExecutor
not just implementedEquatable
but alsoHashable
. So that I don't need to do a linear search through all potential executors and instead can use a dictionary.Proposed solution
Add
Hashable
conformance toUnownedTaskExecutor
.Alternatives considered
No response
Additional information
No response