-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Simplify Dict
representation
#59769
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
base: master
Are you sure you want to change the base?
Simplify Dict
representation
#59769
Conversation
Dict
representation
keys = h.keys | ||
|
||
@assume_effects :terminates_locally :noub @inbounds while true | ||
@assume_effects :terminates_locally :noub @inbounds for _ in 1:sz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these effects needed now that you have a fixed iteration instead of while true
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately, yes. the compiler doesn't know that fixed length iteration terminates
FWIW, you can also just force push (instead of rebasing) to the existing PR to not lose the relevant discussion on it. |
I talked to @vtjnash today, and he pointed out that the point of Given this, this PR as is isn't good as is. If we wanted to remove As such, this will some substantial benchmarking to determine whether the right approach is to remove |
remove
idxfloor
andmaxprobe
, and shrinkage
toUInt32
.idxfloor
is removed because the only thing it helps with is speeding upiterate
calls (very slightly since it only speeds up the first call), and the speedup comes at a cost on insertions and deletions that happen to land near the front of the dict.maxprobe
is removed because if the hash function is good, we know that theDict
will spread values well, and if thehash
function isn't good,rehashing
won't fix anything, so we spend a lot of effort trackingmaxprobe
, but in most circumstances, it won't do anything, and in the circumstances where it does, it probably would be better off if it didn't.Rebased and slightly more aggressive version of #48380 (rebasing was going to be more annoying since that PR was pre
Memory
).