Changeset 126374 in webkit
- Timestamp:
- Aug 22, 2012 6:08:25 PM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r126371 r126374 1 2012-08-22 Dirk Pranke <dpranke@chromium.org> 2 3 Baseline optimizer should try to optimize per-port if global optimization fails 4 https://bugs.webkit.org/show_bug.cgi?id=94665 5 6 Reviewed by Adam Barth. 7 8 Add a fallback strategy for optimizing baselines if the default 9 one fails; this one simply attempts to shift baselines up in the 10 tree and consolidates them if a parent and child in the fallback 11 path have the same result. This strategy is somewhat flawed in 12 that we will always put something in a parent dir even if we 13 "shouldn't"; for example, if chromium-mac produces a different 14 result from chromium-win and chromium-linux, then the new 15 algorithm will move the mac result into platform/chromium, 16 leaving chromium-mac empty. This result is still correct, but 17 perhaps confusing. 18 19 I haven't done much testing of this algorithm yet, so it's not 20 clear how many cases where this does a better job than the 21 default algorithm and how many it'll do a worse job. 22 23 * Scripts/webkitpy/common/checkout/baselineoptimizer.py: 24 (BaselineOptimizer._find_optimal_result_placement): 25 (BaselineOptimizer._optimize_by_most_specific_common_directory): 26 (BaselineOptimizer): 27 (BaselineOptimizer._optimize_by_pushing_results_up): 28 (BaselineOptimizer._find_in_fallbackpath): 29 * Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py: 30 (BaselineOptimizerTest.test_platform_mac_different): 31 1 32 2012-08-22 Dirk Pranke <dpranke@chromium.org> 2 33 -
trunk/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer.py
r126371 r126374 27 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 28 29 import copy 29 30 import logging 30 31 … … 126 127 port_names_by_result = _invert_dictionary(results_by_port_name) 127 128 128 results_by_directory,new_results_by_directory = self._optimize_by_most_specific_common_directory(results_by_directory, results_by_port_name, port_names_by_result)129 new_results_by_directory = self._optimize_by_most_specific_common_directory(results_by_directory, results_by_port_name, port_names_by_result) 129 130 if not new_results_by_directory: 130 pass # FIXME: Try something else.131 new_results_by_directory = self._optimize_by_pushing_results_up(results_by_directory, results_by_port_name, port_names_by_result) 131 132 132 133 return results_by_directory, new_results_by_directory … … 145 146 146 147 if len(new_unsatisfied_port_names_by_result.values()) >= len(unsatisfied_port_names_by_result.values()): 147 break# Frowns. We do not appear to be converging.148 return {} # Frowns. We do not appear to be converging. 148 149 unsatisfied_port_names_by_result = new_unsatisfied_port_names_by_result 149 150 150 return results_by_directory, new_results_by_directory 151 return new_results_by_directory 152 153 def _optimize_by_pushing_results_up(self, results_by_directory, results_by_port_name, port_names_by_result): 154 results_by_directory = results_by_directory 155 best_so_far = results_by_directory 156 while True: 157 new_results_by_directory = copy.copy(best_so_far) 158 for port_name in self._hypergraph.keys(): 159 fallback_path = self._hypergraph[port_name] 160 current_index, current_directory = self._find_in_fallbackpath(fallback_path, results_by_port_name[port_name], results_by_directory) 161 current_result = results_by_port_name[port_name] 162 for index in range(current_index + 1, len(fallback_path)): 163 new_directory = fallback_path[index] 164 if not new_directory in new_results_by_directory: 165 new_results_by_directory[new_directory] = current_result 166 if current_directory in new_results_by_directory: 167 del new_results_by_directory[current_directory] 168 elif new_results_by_directory[new_directory] == current_result: 169 if current_directory in new_results_by_directory: 170 del new_results_by_directory[current_directory] 171 else: 172 # The new_directory contains a different result, so stop trying to push results up. 173 break 174 175 if len(new_results_by_directory) >= len(best_so_far): 176 # We've failed to improve, so give up. 177 break 178 best_so_far = new_results_by_directory 179 180 return best_so_far 181 182 def _find_in_fallbackpath(self, fallback_path, current_result, results_by_directory): 183 for index, directory in enumerate(fallback_path): 184 if directory in results_by_directory and (results_by_directory[directory] == current_result): 185 return index, directory 186 assert False, "result %s not found in fallback_path %s, %s" % (current_result, fallback_path, results_by_directory) 151 187 152 188 def _filtered_results_by_port_name(self, results_by_directory): -
trunk/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py
r126371 r126374 75 75 self.assertEqual(host.filesystem.read_binary_file('/mock-checkout/LayoutTests/platform/chromium/another/test-expected.txt'), 'result A') 76 76 77 def disabled_test_platform_mac_different(self):77 def test_platform_mac_different(self): 78 78 self._assertOptimization({ 79 79 'LayoutTests': '462d03b9c025db1b0392d7453310dbee5f9a9e74',
Note: See TracChangeset
for help on using the changeset viewer.