|
|
## Profiling
|
|
|
## Profiling time
|
|
|
|
|
|
```sh
|
|
|
pip install pyprof2calltree
|
... | ... | @@ -10,3 +10,15 @@ python -m cProfile -o out.cprof script.py args... |
|
|
pyprof2calltree -k -i out.cprof
|
|
|
```
|
|
|
|
|
|
## Profiling memory
|
|
|
|
|
|
Use [memory_profiler](https://github.com/pythonprofilers/memory_profiler)
|
|
|
|
|
|
Note: use the `--python python3` option as indicated in [this issue](https://github.com/pythonprofilers/memory_profiler/issues/144).
|
|
|
|
|
|
```sh
|
|
|
mprof run --python python3 convert.py source-data json-data
|
|
|
mprof plot
|
|
|
```
|
|
|
|
|
|
Optionally decorate some functions with `@profile`, without importing the decorator, as explained in the [README](https://github.com/pythonprofilers/memory_profiler). |