Fix and add output for timing calls

This commit is contained in:
Juan Nunez-Iglesias
2014-12-31 17:07:28 +11:00
parent 53585641d2
commit 4a04a6c90c
+6 -3
View File
@@ -172,10 +172,13 @@ in a different order, even if the number of operations is the same:
>>> import time
>>> im3d = np.random.rand(100, 1024, 1024)
>>> t0 = time.time(); x = in_order_multiply(im3d, 5); t1 = time.time()
>>> print(t1 - t0, "seconds")
>>> print("%.2f seconds" % (t1 - t0))
0.14 seconds
>>> im3d_t = np.transpose(im3d).copy()
>>> im3d_t.shape
(1024, 1024, 100)
>>> s0 = time.time(); x = out_of_order_multiply(im3d, 5); s1 = time.time()
>>> print(s1 - s0, "seconds")
>>> print("Speedup: ", (s1 - s0) / (t1 - t0))
>>> print("%.2f seconds" % (s1 - s0))
1.18 seconds
>>> print("Speedup: %.1fx" % ((s1 - s0) / (t1 - t0)))
Speedup: 8.6x