Optimized the process files loop

Minor optimization to the process_files() function to only dump the
database if there were actually files processed by this invocation of
the function. Avoids writing the large file when nothing has changed.
Also added some print statements that show how long each portion of the
file processing function takes to run.