Originally Python was not designed for numeric computation. As people started using python for various tasks, the need for fast numeric computation arose. And the Numpy was created by a group of people in 2005 to address this challenge.
Many Numpy operations are implemented in C, avoiding the general cost of loops in Python, pointer indirection and per-element dynamic type checking. The speed boost depends on which operations you're performing, but a few orders of magnitude isn't uncommon in number crunching programs.
The following are the main reasons behind the fast speed of Numpy.
1. Numpy array is a collection of similar data-types that are densely packed in memory. A Python list can have different data-types, which puts lots of extra constraints while doing computation on it.
2. Numpy is able to divide a task into multiple subtasks and process them parallelly.
3. Numpy functions are implemented in C. Which again makes it faster compared to Python Lists.
If you found the video valuable, please leave a like and subscribe ❤️ It helps the channel grow and helps me pumping out more such content.
#shorts
#python3 #forloop #forelse #programming #algorithm #programmintips #pythontips #codingtips #coding #developmnet #dev programmer banda