title: bash loop with curl evidencing non-linear scaling of response times
body: <p>I wrote this simple Bash script to detect incidence of error-pages: </p>
  
  <pre><code>date; 
  iterations=10000; 
  count_error=0; 
  count_expected=0; 
  for ((counter = 0; counter &lt; iterations; ++counter)); do 
    if curl -s http://www.example.com/example/path | grep -iq error; 
    then 
      ((count_error++)); 
    else 
      ((count_expected++)); 
    fi; 
  sleep 0.1; 
  done; 
  date;
  echo count_error=$count_error count_expected=$count_expected
  </code></pre>
  
  <p>I'm finding total execution-time does not scale linearly with iteration count. 10 iterations 00:00:12, 100 in 00:01:46, 1000 in 00:17:24, 10000 in ~50 mins, 100000 in ~10 hrs </p>
  
  <p>Can anyone provide insights into the non-linearity and/or improvements to the script?  Is curl unable to fire requests at rate of 10/sec?  Is GC having to periodically clear internal buffers filling up with response text ?</p>