⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 276669 in webkit


Ignore:
Timestamp:
Apr 27, 2021, 3:06:32 PM (5 years ago)
Author:
Sam Sneddon
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):

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r276654 r276669  
     12021-04-27  Sam Sneddon  <gsnedders@apple.com>
     2
     3        Optimize Port._expected_baselines_for_suffixes
     4        https://bugs.webkit.org/show_bug.cgi?id=225115
     5
     6        Reviewed by Jonathan Bedard.
     7
     8        This takes out the join() and splitext() calls from the inner loop as
     9        they are loop invariant, and account for a large proportion of the
     10        function's execution time. After this, exists() account for almost
     11        all.
     12
     13        * Scripts/webkitpy/port/base.py:
     14        (Port._expected_baselines_for_suffixes):
     15
    1162021-04-27  Ryan Haddad  <ryanhaddad@apple.com>
    217
  • trunk/Tools/Scripts/webkitpy/port/base.py

    r276038 r276669  
    385385    def _expected_baselines_for_suffixes(self, test_name, suffixes, all_baselines=False, device_type=None):
    386386        baseline_search_path = self.baseline_search_path(device_type=device_type) + [self.layout_tests_dir()]
     387        fs = self._filesystem
     388        baseline_name_root = fs.splitext(test_name)[0] + '-expected'
    387389
    388390        baselines = []
    389391        for platform_dir in baseline_search_path:
     392            unsuffixed = fs.join(platform_dir, baseline_name_root)
    390393            for suffix in suffixes:
    391                 baseline_filename = self._filesystem.splitext(test_name)[0] + '-expected' + suffix
    392                 if self._filesystem.exists(self._filesystem.join(platform_dir, baseline_filename)):
     394                if fs.exists(unsuffixed + suffix):
     395                    baseline_filename = baseline_name_root + suffix
    393396                    baselines.append((platform_dir, baseline_filename))
    394397
    … …  
    400403
    401404        for suffix in suffixes:
    402             baselines.append((None, self._filesystem.splitext(test_name)[0] + '-expected' + suffix))
     405            baselines.append((None, baseline_name_root + suffix))
    403406        return baselines
    404407
Note: See TracChangeset for help on using the changeset viewer.