Skip to content

Commit

Permalink
short-circuit some iterations in jl_recache_type to speed up loadin…
Browse files Browse the repository at this point in the history
…g of large precompiled packages. (#24407)

extracted from #24399

(cherry picked from commit b8d42d4)
  • Loading branch information
JeffBezanson authored and ararslan committed Nov 8, 2017
1 parent b27e765 commit a05e10f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -3035,6 +3035,8 @@ static jl_datatype_t *jl_recache_type(jl_datatype_t *dt, size_t start, jl_value_
t = dt;
}
assert(t->uid != 0);
if (t == dt && v == NULL)
return t;
// delete / replace any other usages of this type in the backref list
// with the newly constructed object
size_t i = start;
Expand Down Expand Up @@ -3087,8 +3089,7 @@ static void jl_recache_types(void)
if (jl_is_datatype(o)) {
dt = (jl_datatype_t*)o;
v = dt->instance;
assert(dt->uid == -1);
t = jl_recache_type(dt, i + 2, NULL);
t = dt->uid == -1 ? jl_recache_type(dt, i + 2, NULL) : dt;
}
else {
dt = (jl_datatype_t*)jl_typeof(o);
Expand Down

0 comments on commit a05e10f

Please sign in to comment.