Skip to content

Commit

Permalink
Pre-allocate seen to improve inference in unique(f, itr)
Browse files Browse the repository at this point in the history
JuliaLang/julia#36280 introduced the ability to
pre-allocate the container used to track values of `f.(itr)` in
`unique(f, itr)`. Particularly for containers with `Union` elements,
this circumvents significant inference problems.

Related: JuliaLang/julia#36454
  • Loading branch information
timholy committed Jun 30, 2020
1 parent 160efbe commit ffd8182
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Registry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ status(; kwargs...) = status(Context(); kwargs...)
function status(ctx::Context; io::IO=stdout, as_api=false, kwargs...) # TODO split as_api into own function
Context!(ctx; io=io, kwargs...)
regs = Types.collect_registries()
regs = unique(r -> r.uuid, regs) # Maybe not?
regs = unique(r -> r.uuid, regs; seen=Set{Union{UUID,Nothing}}()) # Maybe not?
as_api && return regs
Types.printpkgstyle(ctx, Symbol("Registry Status"), "")
if isempty(regs)
Expand Down
2 changes: 1 addition & 1 deletion src/Types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ function update_registries(ctx::Context, regs::Vector{RegistrySpec} = collect_re
!force && UPDATED_REGISTRY_THIS_SESSION[] && return
errors = Tuple{String, String}[]
registry_urls = nothing
for reg in unique(r -> r.uuid, find_installed_registries(ctx, regs))
for reg in unique(r -> r.uuid, find_installed_registries(ctx, regs); seen=Set{Union{UUID,Nothing}}())
let reg=reg
regpath = pathrepr(reg.path)
if isfile(joinpath(reg.path, ".tree_info.toml"))
Expand Down

0 comments on commit ffd8182

Please sign in to comment.