Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Benchmark flatten #234

Merged
merged 1 commit into from
Oct 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"])
Copy link
Member

@jrevels jrevels Oct 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This overwrites the other "iterators" group defined above, which was likely not your intent.

Instead, it would probably make sense just to add these benchmarks to this existing "iterators" group (e.g. just delete g = addgroup!(SUITE, "iterators", ["flatten"]), add "flatten" as a tag to the existing group, and remove the comment separator).

See also: https://github.com/JuliaCI/BenchmarkTools.jl/blob/master/doc/reference.md#addgroupsuitebenchmarkgroup-id-args

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that.

Would it make sense for addgroup! to error in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hehe, I tend to think that would be a good idea ;-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense for addgroup! to error in this case?

Yeah, this would probably be more useful than the current behavior, which is for addgroup!(suite, id, args...) to be a convenience function implementing g = BenchmarkGroup(args...); suite[id] = g; g.

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