title: How could a Python "print" statement take 100 milliseconds to execute on a Raspberry Pi?
body: <p>I have a Python program that I run on a Windows 7 computer as well as a Raspberry Pi running Linux. On the Windows machine, the main loop of the program takes on average about 4 milliseconds to run. On the Raspberry Pi, it takes on average about 100 milliseconds to run. </p>
  
  <p>I tracked the time difference down to one line of code:</p>
  
  <pre><code>print(newData.decode('utf-8'))
  </code></pre>
  
  <p>If I take out that line of code (which was only in there for debugging purposes anyway), the program runs just as quickly on the Raspberry Pi. </p>
  
  <p>I cannot figure out how this one line of code can take so much longer on the Raspberry Pi than on the Windows machine. Any ideas?</p>
  
  <p>EDITED TO ADD:</p>
  
  <p>Thanks for the various comments. Just to clarify, the line of code listed above was not needed in the program, so I can delete it with no ill effect. But even though I realize that the Raspberry Pi is slower than my desktop computer, one simple line of code would not normally take 100 milliseconds to execute on any computer. </p>
  
  <p>The Raspberry Pi may be slow, but it still runs at 700 MHz, which means 70,000,000 clock ticks in that amount of time. I cannot figure out what could possibly be happening to make the 0.1 second difference since the code on both machines is almost exactly the same. </p>