You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current scanner uses the implementation of f1 which is inefficient.
using BenchmarkTools
n =rand(10:20, 100);
css =rand.(Char, n);
ss =String.(css);
functionf1(ss::Vector{String})
v = Any[]
for s in ss
push!(v, s)
endstring(v...)
endfunctionf2(ss::Vector{String})
v = String[]
for s in ss
push!(v, s)
endjoin(v)
endfunctionf3(ss::Vector{String})
io =IOBuffer()
for s in ss
write(io, s)
endString(take!(io))
endfunctionf4(ss::Vector{String})
result =""for s in ss
result *= s
end
result
end@btimef1($ss);
# 11.076 μs (5 allocations: 7.72 KiB)@btimef2($ss);
# 5.659 μs (12 allocations: 17.71 KiB)@btimef3($ss);
# 3.711 μs (8 allocations: 11.63 KiB)@btimef4($ss);
# 22.196 μs (100 allocations: 296.73 KiB)
We need to replace it to f3.
The text was updated successfully, but these errors were encountered:
Current scanner uses the implementation of
f1
which is inefficient.We need to replace it to
f3
.The text was updated successfully, but these errors were encountered: