Module to visualize where your python script is slow

It provides:

  • Code lines that impact your code speed.
  • Visualisation of slow code lines for quick fix.

Python 3.9
Require matplotlib.pyplot, numpy

from speed_testpy import ScriptProfilerPy

ScriptProfilerPy(filepath=”example_testfile.py”).Profiler()
output > code_profile_output.png

‘Make a copy of your python script to prevent any issues.

‘Executing this script with same packages as your scrpt’s virtual environment.

Your script will be executed as a standard python import

ScriptProfilerPy

Provide the python script path
The module will insert datetime() variable at each non-indented line.

  • Your code is opened, read and duplicated
  • New lines of code are inserted with timestamps
  • A new file is created with the name extension “_STP”.

A python script “SpeedTestPy (STP)” file is created that is, your code + timestamps.

Add lines of code to keep track of execution

 

 

 

To finish reading, please visit source site