Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Use Timeit Module

DZone's Guide to

Use Timeit Module

·
Free Resource

>>> from timeit import Timer
>>> t = Timer('md5.new("md5 is not safe").digest()', 'import md5')
>>> t.timeit()
2.6892227922821803

Quite useful to compare speed of codes.
Read more here
http://diveintopython.org/performance_tuning/timeit.html
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}