Python optimization
Figure out how to optimize where possible at a lower level and explore areas for improvement
- https://stackify.com/how-to-optimize-python-code/
- https://wiki.python.org/moin/PythonSpeed/PerformanceTips
- https://www.reddit.com/r/Python/comments/19789aq/memory_optimization_techniques_for_python/
- https://people.duke.edu/~ccc14/sta-663/MakingCodeFast.html
- https://www.softformance.com/blog/how-to-speed-up-python-code/
- https://www.reddit.com/r/Python/comments/sekrzq/how_to_optimize_python_code/
- https://www.datacamp.com/tutorial/optimization-in-python
- https://www.python.org/doc/essays/list2str/
- https://medium.com/@quanticascience/performance-optimization-in-python-e8a497cdaf11
- https://granulate.io/blog/optimizing-python-why-python-is-slow-optimization-methods/
- https://www.geeksforgeeks.org/optimization-tips-python-code/
Not sure if this is mentioned in one of those links, but you can use python3 -m cProfile main.py to profile a given file, or use the @profile decorator from profilehooks to profile a given function
make sure you don't spend to much time optimizing things that are negligible to the rest of the program
Also, here's a really simple (untested) decorator that logs the runtime of a function after it's run. With a few project-specific modifications it may be useful
import time
def time_fn[F](fn: F) -> F:
def out(*args, **kwargs):
start = time.perf_counter()
fn(*args, **kwargs)
end = time.perf_counter()
logger.log(f'{fn.__name__} took {end - start} seconds')
return out
Hi @kzndotsh is this issue still open, if yes then what is the requirement would like to contribute on this.
Hi @kzndotsh is this issue still open, if yes then what is the requirement would like to contribute on this.
Yes, it's still open. What do you mean by "requirement"? The issue is pretty wide open more as a discussion at the moment I suppose so I'm open to any direction/small changes or other issues can be made.