title: Printing to the console vs writing to a file (speed)
body: <p>In C++, which would be faster if repeated, say, 5000 times:</p>
  
  <pre><code>cout &lt;&lt; "text!" &lt;&lt; endl;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>my_text_file &lt;&lt; "text!" &lt;&lt; endl;
  </code></pre>
  
  <p>(writing to a file vs. cout-ing to the console)</p>
  
  <p>Edit:</p>
  
  <p>I ask because when writing to the console, you see all the text being printed which seems like it would slow down the loop. In a file, you arn't seeing the text being printed, which seems as if it would take less time.</p>
  
  <p>Just tested it:</p>
  
  <p>Console: > 2000 ms using endl and \n</p>
  
  <p>File: 40 ms with endl and 4 ms with \n</p>