@@ -274,4 +274,59 @@ g["Float64", "Int"] = @benchmarkable perf_convert!($x_float, $x_int)
274274g[" Complex{Float64}" , " Int" ] = @benchmarkable perf_convert! ($ x_complex, $ x_int)
275275g[" Int" , " Complex{Float64}" ] = @benchmarkable perf_convert! ($ x_int, $ x_complex)
276276
277+
278+ # ###############
279+ # == and isequal
280+ # ###############
281+
282+ x_range = 1 : 10_000
283+ x_vec = collect (x_range)
284+
285+ g = addgroup! (SUITE, " equality" , [" ==" , " isequal" ])
286+
287+ # Only test cases which do not short-circuit, else performance
288+ # depends too much on the data
289+ for x in (x_range, x_vec, Int16 .(x_range), Float64 .(x_range), Float32 .(x_range))
290+ g[" ==" , string (typeof (x))] = @benchmarkable $ x == $ (copy (x))
291+ g[" isequal" , string (typeof (x))] = @benchmarkable isequal ($ x, $ (copy (x)))
292+
293+ g[" ==" , string (typeof (x_vec), " == " , typeof (x))] =
294+ @benchmarkable $ x_vec == $ x
295+ g[" isequal" , string (typeof (x_vec), " isequa l" , typeof (x))] =
296+ @benchmarkable isequal ($ x_vec, $ x)
297+ end
298+
299+ x_bool = fill (false , 10_000 )
300+ x_bitarray = falses (10_000 )
301+ g[" ==" , " Vector{Bool}" ] = @benchmarkable $ x_bool == $ (copy (x_bool))
302+ g[" isequal" , " Vector{Bool}" ] = @benchmarkable isequal ($ x_bool, $ (copy (x_bool)))
303+ g[" ==" , " BitArray" ] = @benchmarkable $ x_bitarray == $ (copy (x_bitarray))
304+ g[" isequal" , " BitArray" ] = @benchmarkable isequal ($ x_bitarray, $ (copy (x_bitarray)))
305+
306+ # ##########
307+ # any & all
308+ # ##########
309+
310+ x_false = fill (false , 10_000 )
311+ x_true = fill (true , 10_000 )
312+
313+ g = addgroup! (SUITE, " any/all" , [" any" , " all" ])
314+
315+ # Only test cases which do not short-circuit, else performance
316+ # depends too much on the data
317+ g[" any" , " Vector{Bool}" ] = @benchmarkable any ($ x_false)
318+ g[" all" , " Vector{Bool}" ] = @benchmarkable all ($ x_true)
319+ g[" any" , " BitArray" ] = @benchmarkable any ($ (BitArray (x_false)))
320+ g[" all" , " BitArray" ] = @benchmarkable all ($ (BitArray (x_true)))
321+
322+ x_range = 1 : 10_000
323+ for x in (x_range, collect (x_range), Int16 .(x_range), Float64 .(x_range), Float32 .(x_range))
324+ g[" any" , string (typeof (x))] = @benchmarkable any (v -> v < 0 , $ x)
325+ g[" all" , string (typeof (x))] = @benchmarkable all (v -> v > 0 , $ x)
326+
327+ gen = (v for v in x)
328+ g[" any" , string (typeof (x), " generator" )] = @benchmarkable any (v -> v < 0 , $ gen)
329+ g[" all" , string (typeof (x), " generator" )] = @benchmarkable all (v -> v > 0 , $ gen)
330+ end
331+
277332end # module
0 commit comments