Why would using PrincipalSearcher be faster than FindByIdentity()? Why would using PrincipalSearcher be faster than FindByIdentity()? azure azure

Why would using PrincipalSearcher be faster than FindByIdentity()?


The only plausible reason I can think of is that .FindByIdentity has to check multiple attributes for a match, since you're not specifying exactly which attribute you're looking for.

You can do that by specifying the attribute you're looking for (using this method overload) - try this for a comparison:

var user = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, username);

How fast is this?