Skip to content

Commit

Permalink
Benchmark flatten (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
mschauer authored and KristofferC committed Oct 31, 2018
1 parent 9e69028 commit d77f701
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/misc/MiscellaneousBenchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,17 @@ for N in (1,1000), M in 1:4
g["zip($(join(fill("1:$N", M), ", ")))"] = @benchmarkable collect($X)
end

###############################################
# flatten iterator

g = addgroup!(SUITE, "iterators", ["flatten"])
let X = Base.Iterators.flatten(fill(rand(50), 100))
g["sum(flatten(fill(rand(50), 100))))"] = @benchmarkable sum($X)
end
let X = Base.Iterators.flatten(collect((i,i+1) for i in 1:1000))
g["sum(flatten(collect((i,i+1) for i in 1:1000))"] = @benchmarkable sum($X)
end

####################################################
# Allocation elision stumped by conditional #28226 #
# Note, not fixed when this benchmark was written #
Expand Down

0 comments on commit d77f701

Please sign in to comment.