Skip to content

Commit efe1eaf

Browse files
authored
stop "uncompressing" registry data (#4470)
1 parent ca5b089 commit efe1eaf

File tree

11 files changed

+657
-345
lines changed

11 files changed

+657
-345
lines changed

ext/REPLExt/completions.jl

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,32 +78,30 @@ function complete_remote_package!(comps, partial; hint::Bool)
7878
name = regpkg.name
7979
name in cmp && continue
8080
if startswith(regpkg.name, partial)
81-
pkg = Registry.registry_info(regpkg)
81+
pkg = Registry.registry_info(reg, regpkg)
8282
Registry.isdeprecated(pkg) && continue
83-
compat_info = Registry.compat_info(pkg)
84-
# Filter versions
85-
for (v, uncompressed_compat) in compat_info
83+
# Check if any non-yanked version is compatible with current Julia
84+
found_compatible_version = false
85+
for v in keys(pkg.version_info)
8686
Registry.isyanked(pkg, v) && continue
8787
# TODO: Filter based on offline mode
88-
is_julia_compat = nothing
89-
for (pkg_uuid, vspec) in uncompressed_compat
90-
if pkg_uuid == JULIA_UUID
91-
is_julia_compat = VERSION in vspec
92-
is_julia_compat && continue
93-
end
94-
end
95-
# Found a compatible version or compat on julia at all => compatible
96-
if is_julia_compat === nothing || is_julia_compat
97-
push!(cmp, name)
98-
# In hint mode the result is only used if there is a single matching entry
99-
# so we can return no matches in case of more than one match
100-
if hint && found_match
101-
return true # true means returned early
102-
end
103-
found_match = true
88+
# Query compressed compat for this version (optimized: only fetch Julia compat)
89+
julia_vspec = Pkg.Registry.query_compat_for_version(pkg, v, JULIA_UUID)
90+
# Found a compatible version or no julia compat at all => compatible
91+
if julia_vspec === nothing || VERSION in julia_vspec
92+
found_compatible_version = true
10493
break
10594
end
10695
end
96+
if found_compatible_version
97+
push!(cmp, name)
98+
# In hint mode the result is only used if there is a single matching entry
99+
# so we can return no matches in case of more than one match
100+
if hint && found_match
101+
return true # true means returned early
102+
end
103+
found_match = true
104+
end
107105
end
108106
end
109107
end

src/Apps/Apps.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function get_max_version_register(pkg::PackageSpec, regs)
105105
if get(reg, pkg.uuid, nothing) !== nothing
106106
reg_pkg = get(reg, pkg.uuid, nothing)
107107
reg_pkg === nothing && continue
108-
pkg_info = Registry.registry_info(reg_pkg)
108+
pkg_info = Registry.registry_info(reg, reg_pkg)
109109
for (version, info) in pkg_info.version_info
110110
info.yanked && continue
111111
if pkg.version isa VersionNumber

src/Operations.jl

Lines changed: 132 additions & 88 deletions
Large diffs are not rendered by default.

src/Pkg.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ include("GitTools.jl")
110110
include("PlatformEngines.jl")
111111
include("Versions.jl")
112112
include("Registry/Registry.jl")
113-
include("Resolve/Resolve.jl")
114113
include("Types.jl")
114+
include("Resolve/Resolve.jl")
115115
include("BinaryPlatformsCompat.jl")
116116
include("Artifacts.jl")
117117
const Artifacts = PkgArtifacts

0 commit comments

Comments
 (0)