5,337
edits
Line 170: | Line 170: | ||
===Timing Code=== | ===Timing Code=== | ||
[https://stackoverflow.com/questions/2866380/how-can-i-time-a-code-segment-for-testing-performance-with-pythons-timeit | [https://stackoverflow.com/questions/2866380/how-can-i-time-a-code-segment-for-testing-performance-with-pythons-timeit StackOverflow]<br> | ||
[https://docs.python.org/3/library/time.html Python Time Documentation] | |||
* <code>time.time()</code> return the seconds since epoch as a float | |||
* You can also use timeit to time over several iterations | |||
<syntaxhighlight lang="python"> | <syntaxhighlight lang="python"> | ||
import time | import time |