Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix slowness of source indexing and other problems
In late June the source indexing step on Windows builds went from taking about 15 minutes to taking several hours. This is because a rust toolchain directory was added and its files are not mapped in as a git repo. Therefore every one of these files that was referenced in the source information had "git log" run on it, and this command is slow, especially on non-existent files. Source indexing of chrome.dll went from 45 seconds to 4,500 s - 100x slower. Source indexing of gaia1_0.dll was similarly slowed. Nothing else seemed to be affected. The output and C++ toolchain directories are already excluded from source indexing because of this issue, so all we need to do is add another excluded directory. This time I'm adding a --excluded-dirs switch to make it generic and more obvious. I'm also making other changes: 1) The toolchain and output directories used to have to be specified as absolute paths. Passing a relative path would make the script take hours longer. The script should make them absolute, and should fail if the specified directory does not exist. 2) The lack of an encoding passed to subprocess was causing various decode exceptions that presumably caused information to be lost, and also cluttered the output. 3) Some Python 2/3 compatibility hacks can now be removed. 4) Since calling git log when a file doesn't exist is expensive this change adds a message whenever this happens. In my tests this message is never hit. If it starts showing up thousands of times then the cause of the slowdown will be obvious next time. While this CL does make this script handle relative paths, and does fix encoding exceptions, it does not by itself fix the performance issue. For that a change in how this script is called will be needed, after this CL lands. Test commands: #1: reproduce the problem and make sure no exclusion-dirs is handled: vpython3 tools/symsrc/source_index.py out\official_test\chrome.dll.pdb --build-dir=out\official_test --toolchain-dir=third_party\depot_tools\win_toolchain\vs_files\27370823e7 #2: use exclusion-dirs to get a 100x speedup: vpython3 tools/symsrc/source_index.py out\official_test\chrome.dll.pdb --build-dir=out\official_test --toolchain-dir=third_party\depot_tools\win_toolchain\vs_files\27370823e7 --exclusion-dirs=third_party\rust-toolchain #3: use exclusion-dirs with semi-colon separation to replace using --build-dir (still fast): vpython3 tools/symsrc/source_index.py out\official_test\chrome.dll.pdb --toolchain-dir=third_party\depot_tools\win_toolchain\vs_files\27370823e7 --exclusion-dirs=third_party\rust-toolchain;out\official_test A clean copy of chrome.dll.pdb is needed for each test. The freshly built DLL was copied elsewhere and then copied back before each test. See README.chromium for more testing ideas. Bug: 1471723 Change-Id: I9d28a44ba2bed9d52258c42961e14ddf432ac4bd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4771880 Reviewed-by: Sébastien Marchand <sebmarchand@chromium.org> Commit-Queue: Bruce Dawson <brucedawson@chromium.org> Cr-Commit-Position: refs/heads/main@{#1182418}
- Loading branch information