i m using LDAP through c++.

while searching of user in ldap_search function. it is taking lot of time. it is comparing the filter with all the user. i m giving the filter string , still it is searching all the user . loty of time is taking please help me asap.