Title: [212319] trunk/Tools
Revision
212319
Author
[email protected]
Date
2017-02-14 13:01:55 -0800 (Tue, 14 Feb 2017)

Log Message

Use a set instead of a list for tests when parsing expectations
https://bugs.webkit.org/show_bug.cgi?id=168304

In _collect_matching_tests, a lot of membership tests are done on a giant list
of strings. By making it a set instead, we can make those much faster, and
there's no reason for it to be a list.

With ~45k tests and some 1000 expectations, this reduces the parse time from 34s
to 3s on my machine.

Patch by Florian Bruhin <[email protected]> on 2017-02-14
Reviewed by Ryosuke Niwa.

* Scripts/webkitpy/layout_tests/models/test_expectations.py:
(TestExpectationParser.__init__):
(TestExpectationParser._collect_matching_tests):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (212318 => 212319)


--- trunk/Tools/ChangeLog	2017-02-14 20:56:12 UTC (rev 212318)
+++ trunk/Tools/ChangeLog	2017-02-14 21:01:55 UTC (rev 212319)
@@ -1,3 +1,21 @@
+2017-02-14  Florian Bruhin  <[email protected]>
+
+        Use a set instead of a list for tests when parsing expectations
+        https://bugs.webkit.org/show_bug.cgi?id=168304
+
+        In _collect_matching_tests, a lot of membership tests are done on a giant list
+        of strings. By making it a set instead, we can make those much faster, and
+        there's no reason for it to be a list.
+
+        With ~45k tests and some 1000 expectations, this reduces the parse time from 34s
+        to 3s on my machine.
+
+        Reviewed by Ryosuke Niwa.
+
+        * Scripts/webkitpy/layout_tests/models/test_expectations.py:
+        (TestExpectationParser.__init__):
+        (TestExpectationParser._collect_matching_tests):
+
 2017-02-14  Jonathan Bedard  <[email protected]>
 
         Unreviewed build-fix after r212297.

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py (212318 => 212319)


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py	2017-02-14 20:56:12 UTC (rev 212318)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py	2017-02-14 21:01:55 UTC (rev 212319)
@@ -81,7 +81,10 @@
     def __init__(self, port, full_test_list, allow_rebaseline_modifier):
         self._port = port
         self._test_configuration_converter = TestConfigurationConverter(set(port.all_test_configurations()), port.configuration_specifier_macros())
-        self._full_test_list = full_test_list
+        if full_test_list is None:
+            self._full_test_list = None
+        else:
+            self._full_test_list = set(full_test_list)
         self._allow_rebaseline_modifier = allow_rebaseline_modifier
 
     def parse(self, filename, expectations_string):
@@ -189,11 +192,6 @@
     def _collect_matching_tests(self, expectation_line):
         """Convert the test specification to an absolute, normalized
         path and make sure directories end with the OS path separator."""
-        # FIXME: full_test_list can quickly contain a big amount of
-        # elements. We should consider at some point to use a more
-        # efficient structure instead of a list. Maybe a dictionary of
-        # lists to represent the tree of tests, leaves being test
-        # files and nodes being categories.
 
         if not self._full_test_list:
             expectation_line.matching_tests = [expectation_line.path]
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to