Speed up python execution
The first level of learning ends up with knowing basics. The next level of learning moto should be expertise in a particular platform. Those who want to expertise in one particular language, they should learn deeply about 1000 hours. Here I have shared some optimization methods,
- Should be strong in the basics of data structures in python.
- Use in build functions and libraries: Some of the input functions help to write simple code and increase the readability of the function.
- Move calculation out of the loop: If Loop is inside the loop, then execution time will get increase.
- If you are going to process large number data in the list or dictionary, then we can go with numpy (numerical python) or pandas.
- PyPy is Just in Time (JIT) compiler for python. CPython execution time is less than nearly half of the time than the PyPy compiler.
- Avoid more global variables and use the local variables wisely.
- Know more about list comprehension in python.
- Use recursive functions in python products.
- Itertool of method helps to use the loop efficiently.