title: Why would using PrincipalSearcher be faster than FindByIdentity()?
body: <p>I had this code:</p>
  
  <pre><code>var context = new PrincipalContext( ContextType.Machine );
  var user = UserPrincipal.FindByIdentity( context, username );
  </code></pre>
  
  <p>and it took about 2-3 seconds to run. I was recommended to rewrite it using <code>PrincipalSearcher</code> class:</p>
  
  <pre><code>var context = new PrincipalContext( ContextType.Machine );
  var user = new UserPrincipal(context);
  user.SamAccountName = username;
  var searcher = new PrincipalSearcher(user);
  user = searcher.FindOne() as UserPrincipal;
  </code></pre>
  
  <p>and it runs in less than one second - notably faster. The person why advised the rewrite is as clueless as me why it runs faster.</p>
  
  <p>Why does it make any performance difference?</p>