Skip to content

Commit cc4c67c

Browse files
JeffBezansonararslan
authored andcommitted
short-circuit some iterations in jl_recache_type to speed up loading of large precompiled packages. (#24407)
extracted from #24399 (cherry picked from commit b8d42d4)
1 parent d26ec53 commit cc4c67c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/dump.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3035,6 +3035,8 @@ static jl_datatype_t *jl_recache_type(jl_datatype_t *dt, size_t start, jl_value_
30353035
t = dt;
30363036
}
30373037
assert(t->uid != 0);
3038+
if (t == dt && v == NULL)
3039+
return t;
30383040
// delete / replace any other usages of this type in the backref list
30393041
// with the newly constructed object
30403042
size_t i = start;
@@ -3087,8 +3089,7 @@ static void jl_recache_types(void)
30873089
if (jl_is_datatype(o)) {
30883090
dt = (jl_datatype_t*)o;
30893091
v = dt->instance;
3090-
assert(dt->uid == -1);
3091-
t = jl_recache_type(dt, i + 2, NULL);
3092+
t = dt->uid == -1 ? jl_recache_type(dt, i + 2, NULL) : dt;
30923093
}
30933094
else {
30943095
dt = (jl_datatype_t*)jl_typeof(o);

0 commit comments

Comments
 (0)