Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 691 Bytes

File metadata and controls

20 lines (13 loc) · 691 Bytes

Debugging

  1. Getting started with python debugger

Timing code

You can time code in ipython using the %time and %timeit magics. You can also time sections of code using system clock, for example

import numpy as np
import time

init_time = time.clock()  # start clock
x = np.linspace(0,100,1000000)
y = np.sqrt(x)

elap_time = time.clock() - init_time  # finds difference

print "Time elapsed is %0.3f ms" % (elap_time*1000)  # converts to ms