Question: I have a bash script that zips up filenames based on user input. It is working fine albeit slowly since I have, at times, to parse up to 50K files.

```
find "$DIR" -name "$USERINPUT" -print | /usr/bin/zip -1 SearchResult -@

```

The @ sign here means that zip will be accepting file names from STDIN. Is there a way to make it go faster?

I am thinking of creating a cron job to update the locate database every night but I am not root so I don't even if it is worth it.

Any suggestions welcome.

Answer: 
I suggest you make use of parallel processing in xargs command to speed up your entire process. Use a command like this:

```
find "$DIR" -name "$USERINPUT" -print0 | xargs -0 -P10 zip -1 SearchResult -@

```

Above command will make xargs run 10 parallel sub-processes.

Please record timing of above command like this:

```
time find "$DIR" -name "$USERINPUT" -print0 | xargs -0 -P10 zip -1 SearchResult -@

```

and see if this makes any performance improvements.
Sounds like you're trawling through the filesystem running a find for each of the 50,000 files.

Why not do **one** run of find, to log names of all files in the filesystem, and then pluck the locations of them straight from this log file ? 

Alternatively, break the work down into seperate jobs, particularly if you have multiple filesystems and multiple CPUs. No need to be single-threaded in your approach.