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

problem with isbitstype usage after union-splitting optim #28

Open
vtjnash opened this issue Dec 20, 2019 · 1 comment
Open

problem with isbitstype usage after union-splitting optim #28

vtjnash opened this issue Dec 20, 2019 · 1 comment

Comments

@vtjnash
Copy link

vtjnash commented Dec 20, 2019

ptrs = !isbitstype(K)
to = 1
# TODO: to get the best performance we need to avoid reallocating these.
# This algorithm actually works in place, unless the dict is modified
# due to GC during this process.
newkeys = similar(keys, count0)
newvals = similar(vals, count0)
@inbounds for from = 1:length(keys)
if !ptrs || isassigned(keys, from)
k = keys[from]
hashk = hash(k)%Int
isdeleted = false
if !ptrs
iter = 0

The first check (!ptrs || isassigned(keys, from)) can be just isassigned(keys, from) (these should be the same, since isbits arrays are always assigned)

The second check should now use Base.isbitsunion (and perhaps isassigned(values, from) too as an optimization)

@vtjnash vtjnash changed the title problem with problem with isbitstype usage after union-splitting optim Dec 20, 2019
@fingolfin
Copy link
Member

The code now uses isbitsunion but not quite in the way described here. But it seems to work anyway.

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

No branches or pull requests

2 participants