Skip to content

Commit

Permalink
more efficient DefaultsDict iteration (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
BioTurboNick authored Oct 1, 2022
1 parent 228e8c3 commit 8bf3429
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions RecipesPipeline/src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ function Base.delete!(dd::DefaultsDict, k)
end
Base.length(dd::DefaultsDict) = length(union(keys(dd.explicit), keys(dd.defaults)))
function Base.iterate(dd::DefaultsDict)
exp_keys = keys(dd.explicit)
def_keys = setdiff(keys(dd.defaults), exp_keys)
key_list = collect(Iterators.flatten((exp_keys, def_keys)))
key_list = union!(collect(keys(dd.explicit)), keys(dd.defaults))
iterate(dd, (key_list, 1))
end
function Base.iterate(dd::DefaultsDict, (key_list, i))
Expand Down

0 comments on commit 8bf3429

Please sign in to comment.