1. How will you improve the performance of a program in Python?¶
There are many ways to improve the performance of a Python program. Some of these are as follows:
i. Data Structure: We have to select the right data structure for our purpose in a Python program. ii. Standard Library: Wherever possible, we should use methods from standard library. Methods implemented in standard library have much better performance than user implementation.
| iii. | Abstraction: | a lot |
|---|---|---|
| indirection can cause slow performance of a program. We should remove the redundant abstraction in code. | ||
| iv. | Algorithm: Use of right algorithm can make a big |
At times, of abstraction and
difference in a program. We have to find and select the suitable algorithm to solve our problem with high performance.