Skip to content

Commit 16af262

Browse files
Add usage recommendation
1 parent a02c6e8 commit 16af262

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/vboolean.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ Determine whether predicate `p` returns true for any elements over the given `di
6868
If `p` is omitted, test whether any values along the given `dims` are `true`
6969
(in which case `A` should be `AbstractArray{Bool}`).
7070
71+
# Usage Recommendation
72+
If `A` is reasonably small, `vany` may be faster than `any`; however, as the size
73+
of `A` grows, the probability of any element returning true inevitably increases
74+
(it is repeated Bernoulli sampling, thus, even with a very small success probability,
75+
a large number of tries makes may yield a scenario where the `break` of `any` wins out).
76+
Consequently, the probability of individual elements being `true` should determine choice --
77+
if one suspects a reasonable success probability, then `any` may be preferable, depending
78+
on the size `A`. More testing is needed to determine potential breakpoints.
79+
7180
# Additional Notes
7281
This function suffers from the same issue as `vfindmax` and friends -- reductions
7382
which include the first dimension with zero masks are not yet supported by LoopVectorization.

0 commit comments

Comments
 (0)