File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1011,7 +1011,20 @@ function show(io::IO, m::Module)
1011
1011
if is_root_module (m)
1012
1012
print (io, nameof (m))
1013
1013
else
1014
- print (io, join (fullname (m)," ." ))
1014
+ print_fullname (io, m)
1015
+ end
1016
+ end
1017
+ # The call to print_fullname above was originally `print(io, join(fullname(m),"."))`,
1018
+ # which allocates. The method below provides the same behavior without allocating.
1019
+ # See https://github.com/JuliaLang/julia/pull/42773 for perf information.
1020
+ function print_fullname (io:: IO , m:: Module )
1021
+ mp = parentmodule (m)
1022
+ if m === Main || m === Base || m === Core || mp === m
1023
+ print (io, nameof (m))
1024
+ else
1025
+ print_fullname (io, mp)
1026
+ print (io, ' .' )
1027
+ print (io, nameof (m))
1015
1028
end
1016
1029
end
1017
1030
You can’t perform that action at this time.
0 commit comments