Profiling Python Scripts

Created at 2018-08-13 Updated at 2018-08-14 Category Python Tag Python

Profiling Python scripts can help improving the performance and reduce time costs. This post introduces profiling and a visual tool SNAKEVIZ to visualize the profile output data. Python can be very slow in pure Python without C/C++ bindings. Profiling helps to detect the total time costs and output which part of the code consumes time most.

One can easily generate the profile data by runing cProfile module,

python3.6 -m cProfile -o profile.dat

And using SNAKEVIZ, it can render the profile data on a web page.

snakeviz profile.dat

Next …

Table of Content

Site by GoingMyWay using Hexo & Random
备案号: 粤ICP备16087705号-1

I am a ML and RL research student