Reduce run-webkit-tests startup overhead for faster iteration#64594
Open
aproskuryakov wants to merge 1 commit intoWebKit:mainfrom
Open
Conversation
https://bugs.webkit.org/show_bug.cgi?id=314459 rdar://176618242 Reviewed by NOBODY (OOPS!). `run-webkit-tests fast/dom/ChildNode-replaceWith.html` wall clock drops from ~5s to ~2.8s. WebKitTestRunner itself still takes ~1s; the rest is setup overhead that this change trims. Each of these improvements was independently measurable: - LayoutTestHelper's ~440ms color-profile install now overlaps with test discovery instead of blocking _set_up_run. - configuration_for_upload (which pulls in requests, ~80ms) runs only when --report is passed. - webkit-build-directory perl calls: 4 → 1 via a class-level cache and a lazy --target default (~500ms). - WebKitTestRunner warmup is skipped when child_processes == 1. - Several production import paths no longer pull in unittest.mock, webkitcorepy.mocks submodules, the whole requests stack, or the embedded-port chain on a Mac run. - Misc: cached inner finder, precompiled regex, lazy port-factory table. * Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py: (TestExpectationParser._tokenize_line): Collapse whitespace with `" ".join(s.split())` instead of a regex, and precompile _BUG_TOKEN_RE. * Tools/Scripts/webkitpy/port/base.py: (Port.start_helper_async): (Port.wait_for_helper_ready): New no-op defaults; MacPort overrides. Splitting start_helper into a kick-off + join lets the caller overlap the helper with other work. (Port.stop_helper): Reset _helper_start_attempted so a later run isn't mistaken for a failed one. * Tools/Scripts/webkitpy/port/config.py: (Config._build_directories): (Config._clear_cache_for_testing): (Config.build_directory): Cache is class-level now (invariant within a process and sharable across Config instances) and keyed on (port_implementation, configuration, for_host). * Tools/Scripts/webkitpy/port/base_unittest.py: * Tools/Scripts/webkitpy/port/config_unittest.py: (PortTest.setUp): (ConfigTest.setUp): Clear the class cache between tests and between phases within test_build_directory. * Tools/Scripts/webkitpy/port/darwin.py: (DarwinPort.CURRENT_VERSION): Import from version_name_map instead of literal Version(26), to avoid duplication. * Tools/Scripts/webkitpy/port/factory.py: (_lazy_port): (PortFactory.PORT_CLASSES): (PortFactory.get): Replace the eager loop over all 14 port modules with a table mapping port-name prefix → CallByNeed. Only the matched port is imported. (configuration_options): --target now defaults to None. Port.__init__ already calls set_option_default('configuration', self.default_configuration()) after parsing, so the old eager Config.default_configuration() call at option-definition time (one perl invocation every run) is redundant. * Tools/Scripts/webkitpy/port/factory_unittest.py: (FactoryTest.test_port_classes_table_consistency): Assert each prefix in PORT_CLASSES matches the imported class's port_name so the duplication can't silently drift. * Tools/Scripts/webkitpy/port/mac.py: (MacPort.setup_test_run): Skip the warmup invocation when child_processes == 1. (MacPort.start_helper): (MacPort.start_helper_async): (MacPort.wait_for_helper_ready): Split into non-blocking popen + blocking readline. Track _ready on the Popen handle and _helper_start_attempted on the class so wait returns False for a helper that failed to spawn.
Collaborator
|
EWS run on current version of this PR (hash 90cd151) Details
|
Contributor
|
I tried doing a similar thing for api-tests here, which ended up getting reverted, but maybe there's some parts of that change which might be helpful to roll into this change maybe? #60911 |
Contributor
Author
|
I feel like this is already close to being too big, and not sure if any of these would be a speedup for this hero case. Worth looking into separately. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
90cd151
90cd151