[PATCH] D97061: [llvm-cov] Compare path only to find the same file

Choongwoo Han via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 2 08:13:50 PST 2021


tunz added a comment.

@vsk Thanks for looking into it.

Here is some summary of the profiling of LLVMSupport and llvm-cov

top-5 exclusive time for a single core

- llvm::sys::fs::status (44.2s)
- llvm::sys::process::SafelyCloseFileDescriptor (14.2s)
- llvm::sys::fs::openNativeFileInternal (13.6s)
- llvm::sys::fs::getStatus (9.38s)
- std::_Uninitialized_move<llvm::coverage::CountedRegion *, std::allocator<llvm::coverage::CountedRegion>> (4.76s)

top-5 exclusive time for 8 threads

- llvm::ThreadPool::wait (76.6s)
- CodeCoverageTool::getSourceFile (63.6s)
- llvm::sys::fs::status (6.25s)
- std::_Deallocate<16, 0> (4.71s)
- llvm::sys::process::SafelyCloseFileDescriptor (1.99s)

It seems like the performance loss mostly comes from file system accesses.
The time of `status` function includes GetFileAttributesW and CreateFileW calls since I didn't instrument windows apis.

Caching of file path pairs (caching of the comparison function result) did not help because
all of the files are different in my case. The binary for testing contains about 1150 unique files,
which results 1.3 millions of file accesses. I think caching of `status` result might help,
but then we might need to update LLVMSupport.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97061/new/

https://reviews.llvm.org/D97061



More information about the llvm-commits mailing list