What is the fastest way to get index of element in IdentifiedArray? #510
Unanswered
ferologics
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As the title states, is there a
O(1)
way to get the index of an element in IdentifiedArray? In performance sensitive cases (e.g..onAppear
driven actions) it would help to have direct access to the element's index.The boring
O(n)
version would be:Ideally, there would be
elements.indices[id: id]
or the equivalent of that.Maybe this is a potential optimization point for
IdentifiedArray
@stephencelis :)Or I'm missing something obvious in the API 🤓
Beta Was this translation helpful? Give feedback.
All reactions