diff options
author | Frederick Muriuki Muriithi | 2021-12-22 11:37:09 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2021-12-22 11:37:09 +0300 |
commit | 94a4699d6427d60fd629320371b98c7b39d987ff (patch) | |
tree | d113ec7d4199424dd9c70fc4693198fe5884c773 /topics | |
parent | 6d513e3d898b09337a9418bcb5136eaea93b4403 (diff) | |
download | gn-gemtext-94a4699d6427d60fd629320371b98c7b39d987ff.tar.gz |
Start a profiling topic
* Start a profiling topic to help capture some gotchas and help make
the profiling process easier for all involved.
Diffstat (limited to 'topics')
-rw-r--r-- | topics/profiling_python_code.gmi | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/topics/profiling_python_code.gmi b/topics/profiling_python_code.gmi new file mode 100644 index 0000000..d7f9ea0 --- /dev/null +++ b/topics/profiling_python_code.gmi @@ -0,0 +1,22 @@ +# Profiling Python code + +As part of improving the system, there is need to identify and fix/improve the performance bottlenecks in the code. This document details examples of how one would run various profilers, for both GeneNetwork2 and GeneNetwork3 + +## GeneNetwork3 + +### cProfile + +Syntax: + +* env [various-env-vars] python3 -m cProfile the-script.py + +where + +* `[various-env-vars]` is a number of environment variables that might be needed for the running of the script, e.g. `SQL_URI` which is used to define how to connect to the database. +* `the-script.py` is the name of the python script to be run under the profiler + +The output can be redirected, e.g. + +* env [various-env-vars] python3 -m cProfile the-script.py 2>error.log 1>performance.log + +which should help will separating errors from the performance data, for easier analysis |