

Discover more from Daily Dose of Data Science
High-quality insights on Data Science and Python, along with best practices — shared daily.
Get a free 550+ page data science PDF guide and 450+ practice questions notebook.
Over 50,000 subscribers
Continue reading
Vectorization Does Not Always Guarantee Better Performance
Vectorization is well-adopted for improving run-time performance. In a nutshell, it lets you operate data in batches instead of processing a single value at a time.
Although vectorization is extremely effective, you should know that it does not always guarantee performance gains. Moreover, vectorization is also associated with memory overheads.
As demonstrated above, the non-vectorized code provides better performance than the vectorized version.
P.S. 𝐚𝐩𝐩𝐥𝐲() is also a for-loop.
Further reading: Here.
Share this post on LinkedIn: Post Link.
I like to explore, experiment and write about data science concepts and tools. You can read my articles on Medium. Also, you can connect with me on LinkedIn.