Skip to content
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

Add option for HashIndex & UniqueHashIndex to hash lazily #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kcajf
Copy link
Contributor

@kcajf kcajf commented May 9, 2020

This is useful to me, and could be useful to others. I often have UniqueHashIndexes that never get indexed into into (either the indexing is more often happening on another dimension, or the indexing is a nice to have for interactive sessions).
This could also give us cheap views of HashIndex AcceleratedArrays - just take a view of the parent array and construct a lazy HashIndex from it.

Only downside is that there now has to be a small check every time the dictionary is accessed. This is acceptable to me, though it could maybe prevent certain optimisations in very loopy indexing code (the dictionary access might not get hoisted out of the loop)?
If it's a big deal, we could make these lazy variants separate types.

In terms of the code - tossed up whether to have a Bool field or a Union{D,Nothing} dictionary. The latter is nicer but seemed a little fiddlier.

@andyferris
Copy link
Owner

Hmm - this is very interesting! Can you elaborate when this is useful? I tended to assumed people would attach indices precisely where they are needed (and nowhere else) kind of like when a DBA carefully optimizes their database indices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants