I'm new to cprofile but I'm running it on a python tool written for ArcGIS. It tells me that the most time consuming function is the lambda function in _base.py:
ncalls | tottime | percall | cumtime | percall | filename:lineno(function) |
---|---|---|---|---|---|
17875 | 137.877 | 0.008 | 200.404 | 0.011 | _base.py:510(<lambda>) |
962732 | 67.568 | 0 | 67.568 | 0 | {built-in method createobject} |
7497 | 44.223 | 0.006 | 44.223 | 0.006 | {built-in method distanceto} |
8301909/8300996 | 35.652 | 0 | 35.659 | 0 | {getattr} |
713 | 35.235 | 0.049 | 35.235 | 0.049 | {built-in method listfields} |
_base.py is an arcpy file in this location:
C:\Program Files (x86)\ArcGIS\Desktop10.8\arcpy\arcpy\geoprocessing
How can I dig deeper and find out what's using this lambda function?
The tool is over 5000 lines of code so I can't post it but I'm importing cprofile at the start:
import cProfile, pstats
profiler = cProfile.Profile()
profiler.enable()
then disabling it and dumping the stats just before the end:
profiler.disable()
stats.dump_stats(myStatsLocation)