Skip to content

Commit f1b5abc

Browse files
authored
Improve performance of Symbol concatenation (#41992)
1 parent 2445000 commit f1b5abc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

base/strings/substring.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,13 @@ end
205205
return n
206206
end
207207

208-
function string(a::Union{Char, String, SubString{String}}...)
208+
@inline function __unsafe_string!(out, s::Symbol, offs::Integer)
209+
n = sizeof(s)
210+
GC.@preserve s out unsafe_copyto!(pointer(out, offs), unsafe_convert(Ptr{UInt8},s), n)
211+
return n
212+
end
213+
214+
function string(a::Union{Char, String, SubString{String}, Symbol}...)
209215
n = 0
210216
for v in a
211217
if v isa Char

0 commit comments

Comments
 (0)