Speed up parsing of TestExpectations
Currently the parsing step of TestExpectations takes ~11 seconds on a development machine, with the majority of that time in the _collect_matching_tests() step, building the list of |matching_tests|. This can be sped up considerably by changing _all_tests from a flat list of test names to a dictionary tree of path components. Then matching a directory of tests is a search in the tree + iterating the subtree below the matching directory node, instead of a search through the full list with substring matching. This reduces the time locally for parsing TestExpectations from ~11 to ~3 seconds, saving ~72% of the time on this step. With logging in web_tests/controllers/manager.py: + _log.debug("> build TestExpectations"); + start = time.time() self._expectations = test_expectations.TestExpectations(self._port, test_names) + _log.debug("< build TestExpectations %fs", time.time()-start); Before: 15:28:22.789 167015 < build TestExpectations 11.192820s After: 11:23:38.824 11280 < build TestExpectations 3.105809s On the windows try bot: Before: https://chromium-swarm.appspot.com/task?id=4874d0c111ee7a10 11:48:32.359 11980 Parsing expectations ... 11:49:15.140 11980 Found 3676 tests (total 86570); running 3439, skipping 237. = 43 seconds After: https://chromium-swarm.appspot.com/task?id=4874f28bff322210 12:24:46.461 11648 Parsing expectations ... 12:25:22.805 11648 Found 3676 tests (total 86570); running 3439, skipping 237. = 36 seconds R=robertma@chromium.org Bug: 982208 Change-Id: I04f5c3c1b09cf4f1b42ad501d624f83f6f378a97 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1906472Reviewed-by:Robert Ma <robertma@chromium.org> Commit-Queue: danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/master@{#714530}
Showing
Please register or sign in to comment