Skip to content

Commit

Permalink
Add bench_findall.jl (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf authored and mergify[bot] committed Jan 23, 2020
1 parent ceebf34 commit c84643c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions benchmark/bench_findall.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module BenchFindall

using BenchmarkTools
using Transducers

needle = 123.0
xs = rand(100_000)
xs[xs.>0.001] .= needle

suite = BenchmarkGroup()
suite["base"] = @benchmarkable findall(isequal($needle), $xs)
suite["xf-array"] = @benchmarkable collect(
Enumerate() |> Filter(!isequal($needle) last) |> Map(first),
$xs,
)
suite["xf-iter"] = @benchmarkable collect(
Enumerate() |> Filter(isequal($needle) last) |> Map(first),
(x for x in $xs),
)

end # module
BenchFindall.suite

0 comments on commit c84643c

Please sign in to comment.