We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fbcbbf3 commit f6aa09fCopy full SHA for f6aa09f
base/show.jl
@@ -1096,7 +1096,20 @@ function show(io::IO, m::Module)
1096
if is_root_module(m)
1097
print(io, nameof(m))
1098
else
1099
- print(io, join(fullname(m),"."))
+ print_fullname(io, m)
1100
+ end
1101
+end
1102
+# The call to print_fullname above was originally `print(io, join(fullname(m),"."))`,
1103
+# which allocates. The method below provides the same behavior without allocating.
1104
+# See https://github.com/JuliaLang/julia/pull/42773 for perf information.
1105
+function print_fullname(io::IO, m::Module)
1106
+ mp = parentmodule(m)
1107
+ if m === Main || m === Base || m === Core || mp === m
1108
+ print(io, nameof(m))
1109
+ else
1110
+ print_fullname(io, mp)
1111
+ print(io, '.')
1112
1113
end
1114
1115
0 commit comments