Performance-improvement: Combine boolean masks #39
Labels
concerns: GeoGraph
kind: enhancement
New feature or request
kind: performance
performance improvement
requires: benchmarks
Requires benchmarking of code
If numpy does short-circuit evaluation on these things this it'd be slightly faster to combine boolean masks.
Does anyone know how numpy handles these type of cases (below)?
Case:
Case
select_from_array[np.logical_or(condition_array1, condition_array2)]
Does it first evaluate both
condition_array1
andcondition_array2
in the slice[ ... ]
and thenor
the conditions (in which case it'd probably be slower bc we would calculate the geometry overlaps for shapes which won't agree in class label).Or does it calculate the first element of
condition_array1
and then short-circuit decide if that element ofcondition_array2
even needs to be calculated? (in which case I think it should be slightly faster)Originally posted by @Croydon-Brixton in #28 (comment)
The text was updated successfully, but these errors were encountered: