title: PHP file_put_contents performance on 750 thousand lines text files
body: <p>This PHP script adds lines into my text file (log):</p>
  
  <pre><code>file_put_contents($filename, $log .PHP_EOL, FILE_APPEND | LOCK_EX);
  </code></pre>
  
  <p>I am limiting log files to stay within 100Mb, thereafter a new file will be created; thus I expect aprox. 144 bytes per line and around 750000 lines per file.</p>
  
  <p>I need to log actions and I need to log them fast. Does anyone know if <code>file_put_contents</code> performance will progressively be slower with such big files?</p>
  
  <p>Maybe they are not big in size but certainly are big in the number of lines.</p>
  
  <p>---- Update: ----</p>
  
  <p>Based on Cully Larson suggestion here is the results of how much time file_put_contents took to write the exact same $string into a plain-text file. I am running WAMP server for Windows.</p>
  
  <pre><code>Line 000001 150bytes --&gt; 0.00046801567077637 seconds
  Line 000002 150bytes --&gt; 0.00022101402282715 seconds
  Line 000003 150bytes --&gt; 0.00019407272338867 seconds
  ...
  Line 000010 150bytes --&gt; 0.00016212463378906 seconds
  ...
  Line 000100 150bytes --&gt; 0.00015997886657715 seconds
  ...
  Line 001000 150bytes --&gt; 0.00015687942504883 seconds
  ...
  Line 010000 150bytes --&gt; 0.00016403198242188 seconds
  ...
  Line 100000 150bytes --&gt; 0.00016617774963379 seconds
  ...
  Line 250000 150bytes --&gt; 0.0001678466796875 seconds
  ...
  Line 500000 150bytes --&gt; 0.00016283988952637 seconds
  ...
  Line 750000 150bytes --&gt; 0.00020289421081543 seconds
  
  EOF!
  </code></pre>
  
  <p>Hope this information helps someone else too.</p>