2 ms·
Vectorized array functions are easier for the compiler to optimize than for loops. Once things get nested the performance comparison isn’t even close.
by rm_-rf_slash 5y ago
Vectorized array functions are easier for the compiler to optimize than for loops. Once things get nested the performance comparison isn’t even close.
- Etheryte 5y agoAs a standalone idea yes, however in practice this is not actually the case [0], mostly due to those methods having a number of extra checks, more functionality built into them etc. [0] https://stackoverflow.com/q/21037888/1470607 https://stackoverflow.com/q/21037888/1470607
- rm_-rf_slash 5y agoFair point, although as the answer states, it depends on use cases. Working with small datasets the performance difference is negligible, but with decently large datasets (~1-100mb) and nested loops the delta is night and day.