title: Fast string comparison in C
body: <p>I currently have this kind of loop</p>
  
  <pre><code>while(1)
  {
      generate_string(&amp;buffer);
  
      for(int i = 0; i &lt; filelines; i++)
      {
          if(strcmp(buffer,line[i]) == 0)
          {
             /*  do something  */
          }
      }
  }
  </code></pre>
  
  <p>I have a file with a few million strings(which hopefully should be cut by half sometime soon), the number of all these strings is stored in <strong>filelines</strong></p>
  
  <p>line[i] is basically where the string itself is stored.</p>
  
  <p>Currently, due to the comparison of these million strings, function <strong>generate_string(&amp;buffer);</strong> is executed around 42 times per second.
  Is there a faster way to do string comparison in C?</p>