in reply to Re: Quick User Existance Check?
in thread Quick User Existance Check?

Hi There, I indeed do have a finished app, but am concerned about how long it is going to take for my script to detect if a user exists on the system when there are 500,000+ users on it.

On a seperate note, how long would you say that 500,000 lines of usernames in a file would take to search?

Replies are listed 'Best First'.
Re: Re: Re: Quick User Existance Check?
by waswas-fng (Curate) on Jun 25, 2003 at 21:17 UTC
    If it is a local password file you will run into about the same issue I described above where the search can take like 10 seconds per name with the std lib getpwnam. building a hash will take about that same amount of time but the time will be preloaded -- meaning getpwnam of 1000 users against a 500,000 user /etc/passwd file you get 1000 x N (N = number of secs to search the file) hash method you get N + (Y x 1000) where Y is the time it takes to lookup a hash entry in perl (not very long)

    -Waswas