[llvm-cov] Cache file status information
authorChoongwoo Han <choongwoo.han@microsoft.com>
Wed, 3 Mar 2021 17:53:09 +0000 (09:53 -0800)
committerVedant Kumar <vsk@apple.com>
Wed, 3 Mar 2021 18:04:07 +0000 (10:04 -0800)
commit9d8a3e75b442ad7f5cdcb3c8d5b968d8189f46d2
treee094e5184420514c59c336d24131287c9c36bc3d
parent9ee61cf3f67b9fdcee7c2dd650321264376bc0f2
[llvm-cov] Cache file status information

Currently, getSourceFile accesses file system to check if two paths are
the same file with a thread lock, which is a huge performance bottleneck
in some cases. Currently, it's accessing file system size(files) * size(files) times.

Thus, cache file status information, which reduces file system access to size(files) times.

When I tested it with two binaries and 16 cpu cores,
it saved over 70% of time.

Binary 1: 56 secs -> 3 secs
Binary 2: 17 hours -> 4 hours

Differential Revision: https://reviews.llvm.org/D97061
llvm/tools/llvm-cov/CodeCoverage.cpp