Closed ieaves closed 4 years ago
Things that follow the formula series.apply(condition_returning_bool).all()
can be replaced with all(condition_returning_bool(x) for x in series)
reliably because apply is internally looping in python anyways and the former doesn't benefit from any shortcircuiting of the condition evaluation.
We have to be a little more careful when there's a tradeoff between vectorization and short circuiting.
If we think that
all(condition(x) for x in series)
is a speedup in general, we should replace them all over the place, don't you think?There are a few types where we now use a mixed approach, e.g. https://github.com/ieaves/tenzing/blob/speedups/src/visions/core/model/types/tenzing_url.py#L10