title: Why does printing a return carriage significantly reduce the rate at which a printf statement executes in C
body: <p>The following code executes and prints a statement ~20 times a second.</p>
  
  <pre><code>    while (1) {
          TX(port, "j1");
          usleep(30000);
          printf("\nPosition:\t%s",  (*RX(port)).data);
      }
  </code></pre>
  
  <p>Rather than constant new lines, I wish to have a single line printed, with the string that follows <code>Position:</code> updated as quickly as possible. To do so, I've replaced the new line with a carriage return:</p>
  
  <pre><code>    while (1) {
          TX(port, "j1");
          usleep(30000);
          printf("\rPosition:\t%s",  (*RX(port)).data);
      }
  </code></pre>
  
  <p>It is producing the exact format I want, but now I only get a print every ~6 seconds. Can anyone explain why and offer a solution?</p>