Title: [276669] trunk/Tools
Revision
276669
Author
[email protected]
Date
2021-04-27 15:06:32 -0700 (Tue, 27 Apr 2021)

Log Message

Optimize Port._expected_baselines_for_suffixes
https://bugs.webkit.org/show_bug.cgi?id=225115

Reviewed by Jonathan Bedard.

This takes out the join() and splitext() calls from the inner loop as
they are loop invariant, and account for a large proportion of the
function's execution time. After this, exists() account for almost
all.

* Scripts/webkitpy/port/base.py:
(Port._expected_baselines_for_suffixes):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (276668 => 276669)


--- trunk/Tools/ChangeLog	2021-04-27 21:07:32 UTC (rev 276668)
+++ trunk/Tools/ChangeLog	2021-04-27 22:06:32 UTC (rev 276669)
@@ -1,3 +1,18 @@
+2021-04-27  Sam Sneddon  <[email protected]>
+
+        Optimize Port._expected_baselines_for_suffixes
+        https://bugs.webkit.org/show_bug.cgi?id=225115
+
+        Reviewed by Jonathan Bedard.
+
+        This takes out the join() and splitext() calls from the inner loop as
+        they are loop invariant, and account for a large proportion of the
+        function's execution time. After this, exists() account for almost
+        all.
+
+        * Scripts/webkitpy/port/base.py:
+        (Port._expected_baselines_for_suffixes):
+
 2021-04-27  Ryan Haddad  <[email protected]>
 
         [ews] Configure bots for stress test queue

Modified: trunk/Tools/Scripts/webkitpy/port/base.py (276668 => 276669)


--- trunk/Tools/Scripts/webkitpy/port/base.py	2021-04-27 21:07:32 UTC (rev 276668)
+++ trunk/Tools/Scripts/webkitpy/port/base.py	2021-04-27 22:06:32 UTC (rev 276669)
@@ -384,12 +384,15 @@
 
     def _expected_baselines_for_suffixes(self, test_name, suffixes, all_baselines=False, device_type=None):
         baseline_search_path = self.baseline_search_path(device_type=device_type) + [self.layout_tests_dir()]
+        fs = self._filesystem
+        baseline_name_root = fs.splitext(test_name)[0] + '-expected'
 
         baselines = []
         for platform_dir in baseline_search_path:
+            unsuffixed = fs.join(platform_dir, baseline_name_root)
             for suffix in suffixes:
-                baseline_filename = self._filesystem.splitext(test_name)[0] + '-expected' + suffix
-                if self._filesystem.exists(self._filesystem.join(platform_dir, baseline_filename)):
+                if fs.exists(unsuffixed + suffix):
+                    baseline_filename = baseline_name_root + suffix
                     baselines.append((platform_dir, baseline_filename))
 
             if not all_baselines and baselines:
@@ -399,7 +402,7 @@
             return baselines
 
         for suffix in suffixes:
-            baselines.append((None, self._filesystem.splitext(test_name)[0] + '-expected' + suffix))
+            baselines.append((None, baseline_name_root + suffix))
         return baselines
 
     def expected_baselines(self, test_name, suffix, all_baselines=False, device_type=None):
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to