コードのセクションをスピードテストするためにPythonで2回比較する適切な方法は何ですか? API ドキュメントを読んでみました。timedelta のことを理解しているかどうかはわかりません。
これまでのところ、私はこのコードを持っています:
from datetime import datetime
tstart = datetime.now()
print t1
# code to speed test
tend = datetime.now()
print t2
# what am I missing?
# I'd like to print the time diff here