Skip to content

Instantly share code, notes, and snippets.

@maphew
Last active March 11, 2020 13:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maphew/75fe87663313c6eba3c5d747dff7f2cc to your computer and use it in GitHub Desktop.
Save maphew/75fe87663313c6eba3c5d747dff7f2cc to your computer and use it in GitHub Desktop.
What is your "import arcpy" overhead?
'''Measure and report the time it takes to simply `import arcpy`
Part of https://community.esri.com/message/914048-re-what-is-your-import-arcpy-overhead?
'''
from timeit import default_timer as timer
start = timer()
from datetime import datetime, timedelta
from uuid import uuid4
eventid = datetime.now().strftime('%Y%m-%d%H-%M%S-') + str(uuid4())
start_arc = timer()
import arcpy
done_arc = timer() - start_arc
import os
machine = os.environ['COMPUTERNAME']
d = arcpy.GetInstallInfo()
print("{:12} {:10} {:10} {:10} {:10} {:>10} {:>56}".format("Machine",
"Product",
"Version",
"Build",
"License",
"LoadArcpy",
"EventID"))
print("{:12} {:10} {:10} {:10} {:10} {:>10} {:>56}".format(machine,
d['ProductName'],
d['Version'],
d['BuildNumber'],
d['LicenseLevel'],
round(done_arc,3),
eventid))
Machine Product Version Build License LoadArcpy EventID
ENV-Y225411 ArcGISPro 2.5 22081 Advanced 8.005 202003-0616-3707-a5291176-75df-44dc-bc20-5bc845fa6e21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment