-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dropdown function is inefficient #252
Labels
Comments
I have implemented this and it's currently in reflex-dom-contrib reflex-frp/reflex-dom-contrib#62 |
goolord
changed the title
dropdown function repeats work
dropdown function is inefficient
Jan 22, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the dropdown function is currently implemented like this
this repeats a ton of work and calls a bunch of O(n*log n) functions. it also takes a Map as an argument, despite the fact that it just ends up turning it into a Bimap, which can lead to some confusion as Bimap will delete nonunique keys / values. if you write the function like this instead:
you eliminate a tremendous amount of work, at the expense of the "value" attribute not being the index.
if it is important that the value attribute stay the index, it would be trivial to just zip the index with one of the keys.
alternatively, instead of taking in a
Bimap
, it would also be possible to take some indexed data structure like a Set of pairs or something, but that would require an alternative to thelistWithKey
function to be written.as long as this isn't controversial, it would be trivial for me to change this to taste and pr my changes
The text was updated successfully, but these errors were encountered: