title: How to analyze a Python code's performance?
body: <p>Regards. To analyze Python code's performance, may the code below does it?  </p>
  
  <pre><code>import time
  
  to = time.clock(); x = [];
  for i in range(0,4):
      x.append(i*0.1);
  tend = time.clock(); print(tend-to);
  
  to = time.clock();
  y = list(map(lambda x: x*0.1, list(range(0,4))));
  tend = time.clock(); print(tend-to);
  </code></pre>
  
  <p>The timers show inconsistency. But sometimes, the result of the two timers also shows inconsistency (sometimes the first timer is faster, sometimes the second one is, although the first one tends to be faster). Some outputs :</p>
  
  <pre><code>4.631622925399206e-05
  4.4898385501326854e-05
  
  4.9624531343562917e-05
  6.852911471254275e-05
  
  5.0569760512011734e-05
  4.867930217511418e-05
  
  3.78091667379527e-05
  2.5993802132341648e-05
  </code></pre>
  
  <p>My question pertain to the code above : </p>
  
  <ul>
  <li>I thought timer to calculate a code performance should be consistent? How to know that a syntax or a tactic performs better than the other? (run more efficiently than the other) Any thoughts on this?</li>
  </ul>
  
  <p>Thanks before. Regards, Arief</p>