Skip to content

Commit

Permalink
Slightly improve bench_append.jl for SVector (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Jul 1, 2020
1 parent c576c82 commit 9aa6d53
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions benchmark/bench_append.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ function repeat_append!(dest, src, n_repeat = 100, n_values = 1000)
end
end

repeat_append(dest, src) =
foldl(append!!, ntuple(_ -> src, 10); init = dest)

suite = BenchmarkGroup()
suite["append!!(::Vector, ::SingletonVector)"] =
@benchmarkable(repeat_append!($(Float64[]), SingletonVector(1.0)))
suite["append!!(::SVector, ::SingletonVector)"] =
@benchmarkable(repeat_append!(SVector{0,Float64}(), SingletonVector(1.0)))
@benchmarkable(repeat_append(SVector{0,Float64}(), SingletonVector(1.0)))
suite["append!!(Empty(SVector), ::SingletonVector)"] =
@benchmarkable(repeat_append!(Empty(SVector), SingletonVector(1.0)))
@benchmarkable(repeat_append(Empty(SVector), SingletonVector(1.0)))

end # module
BenchAppend.suite

0 comments on commit 9aa6d53

Please sign in to comment.