title: Python - difference in speed between command line and browser
body: <p>I am timing the execution of a script by subracting one <code>time.time()</code> from another one, the first at the start and the second one at the end of the code.</p>
  
  <p>I realize that when I run the script from command line, the execution is much faster (0.09s) than if I request it through the browser (0.14s). I repeated it several times and the time is always in that range.</p>
  
  <p>Can anyone help to understand why it takes much more when requested through the browser.</p>
  
  <p>One difference I realized so far is that if I request the script throught the browser, <code>sys.path</code> doesn't contain the current directory (in which I placed an empty <code>__init__.py</code> file), while if I run it via command line, the current directory is cointained in <code>sys.path</code></p>
  
  <p>EDIT:</p>
  
  <p>I had some print statements inside a function called by worker threads running in parallel (my script is fetching some files in parallel)</p>
  
  <p>I verified that:
  1) when the print statements are there, the script is executed much faster via command line than via the browser
  2) when I remove the print statements, the script is executed via browser as fast as it is via command line</p>
  
  <p>any explanation for that?</p>
  
  <p>(if you are wondering which Python version I am using, it's 2.6.6)</p>