Experiment with different optimization techniques in Python, such as using list comprehensions vs. traditional loops, optimizing function calls, or leveraging parallel processing with libraries like multiprocessing or concurrent.futures.
- File name:
function_calls.py
This experiment is to compare writing code directly in the script and using a method of a class. The main focus is on the execution time between the two methods of writing python code. As you see in the result of the experiment using oop in python is a better way of writing code than just writing scripts without ordering them into classes or functions.
- Results:
Directly scripted code method
Execution time: 0.03252672300004633 seconds
Function method
Execution time: 0.014201193996996153 seconds
Directly scripted code method
Execution time: 0.03501787199638784 seconds
Function method
Execution time: 0.014419317994907033 seconds
The result explains why it is a better choice to use oop method for programming in python in terms of execution time. For complex tasks it is definitely better to use oop rather than just do scripting without ordering them into functions and classes. Since in the factory the tasks are complex and programmers have to work with either large data set or complex code it is beneficial to use oop. This experiment is to show the execution time difference between the two approaches.