>>> 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
12381 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
>>> from timeit import Timer >>> t = Timer('md5.new("md5 is not safe").digest()', 'import md5') >>> t.timeit() 2.6892227922821803
You need to create an account or log in to post comments to this site.