For some reasons, searching for Users or Groups in SharePoint is extremely slow. For example, a simple call to
results = SPUtility.SearchWindowsPrincipals(SPContext.Current.Site.WebApplication, "Stum",SPPrincipalType.User, 50, out maxReached);
takes 21 seconds.
Querying Active Directory directly takes less than a second, and so does a SQL Query against the Profile Database.
I don't understand why it takes so long, but it's consistent with doing a similar query in the SharePoint built-in People Picker.
Any way to speed this up to normal speeds?