Improve the performance of loading a compilation database.

With these changes, running `clang-tags load` now takes 0.98s instead of 2m 21s on a project with about 230 source files.