title: Code optimization; switch versus if's
body: <p>I have a question about whether to use 'case' or 'ifs' in a function that gets called quite a lot. 
  Here's the following as it is now, in 'ifs'; the code is self-explanatory:</p>
  
  <pre><code>int identifyMsg(char* textbuff) {
  if (!strcmp(textbuff,"text")) {
      return 1;
  }
  if (!strcmp(textbuff,"name")) {
      return 2;
  }
  if (!strcmp(textbuff,"list")) {
      return 3;
  }
  if (!strcmp(textbuff,"remv")) {
      return 4;
  }
  if (!strcmp(textbuff,"ipad")) {
      return 5;
  }
  if (!strcmp(textbuff,"iprm")) {
      return 6;
  }
  return 0;
  }
  </code></pre>
  
  <p>My question is: Would a switch perform better? I know if using 'ifs', I can place the most likely options at the top. </p>