Skip to content

Commit

Permalink
Improve performance of Symbol concatenation (#41992)
Browse files Browse the repository at this point in the history
  • Loading branch information
BioTurboNick authored Aug 26, 2021
1 parent 2445000 commit f1b5abc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion base/strings/substring.jl
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,13 @@ end
return n
end

function string(a::Union{Char, String, SubString{String}}...)
@inline function __unsafe_string!(out, s::Symbol, offs::Integer)
n = sizeof(s)
GC.@preserve s out unsafe_copyto!(pointer(out, offs), unsafe_convert(Ptr{UInt8},s), n)
return n
end

function string(a::Union{Char, String, SubString{String}, Symbol}...)
n = 0
for v in a
if v isa Char
Expand Down

0 comments on commit f1b5abc

Please sign in to comment.