Optimization
- 17 Oct 2021
- 1 Minute to read
- Print
- DarkLight
Optimization
- Updated on 17 Oct 2021
- 1 Minute to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
import cProfile
def startProfiling(pr):
pr.enable()
def stopProfiling(pr):
import pstats, cStringIO
pr.disable()
s = cStringIO.StringIO()
ps = pstats.Stats(pr, stream=s).sort_stats('cumulative')
ps.print_stats()
print(s.getvalue())
if enable_profiling:
pr = cProfile.Profile()
startProfiling(pr)
...
if enable_profiling:
stopProfiling(pr)
setSSQueryDefaults(timeoutsec=600
Was this article helpful?