Title: [105332] trunk/Tools
Revision
105332
Author
o...@chromium.org
Date
2012-01-18 15:14:56 -0800 (Wed, 18 Jan 2012)

Log Message

Shave 0.5 seconds off check-webkit-style runtime for test_expectations.txt
https://bugs.webkit.org/show_bug.cgi?id=76576

Reviewed by Adam Barth.

Avoid calling default_configuration in base.py. We don't need it for
checking test_expectations.txt style. It takes ~0.5 seconds to run on my
Mac Pro. It's the call to "perl Tools/Scripts/webkit-build-directory --top-level"
from common.executive.

At some point someone should probably look into why that call is so slow
since it's on the critical path for run-webkit-tests and build-webkit startup.

* Scripts/webkitpy/layout_tests/port/base.py:
(Port.__init__):
* Scripts/webkitpy/style/checkers/test_expectations.py:
(TestExpectationsChecker._determine_port_from_exepectations_path):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (105331 => 105332)


--- trunk/Tools/ChangeLog	2012-01-18 23:07:26 UTC (rev 105331)
+++ trunk/Tools/ChangeLog	2012-01-18 23:14:56 UTC (rev 105332)
@@ -1,3 +1,23 @@
+2012-01-18  Ojan Vafai  <o...@chromium.org>
+
+        Shave 0.5 seconds off check-webkit-style runtime for test_expectations.txt
+        https://bugs.webkit.org/show_bug.cgi?id=76576
+
+        Reviewed by Adam Barth.
+
+        Avoid calling default_configuration in base.py. We don't need it for
+        checking test_expectations.txt style. It takes ~0.5 seconds to run on my
+        Mac Pro. It's the call to "perl Tools/Scripts/webkit-build-directory --top-level"
+        from common.executive.
+
+        At some point someone should probably look into why that call is so slow
+        since it's on the critical path for run-webkit-tests and build-webkit startup.
+
+        * Scripts/webkitpy/layout_tests/port/base.py:
+        (Port.__init__):
+        * Scripts/webkitpy/style/checkers/test_expectations.py:
+        (TestExpectationsChecker._determine_port_from_exepectations_path):
+
 2012-01-18  Dirk Pranke  <dpra...@chromium.org>
 
         [chromium] move Tools.gyp, switch build-webkit --chromium to All.gyp

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py (105331 => 105332)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2012-01-18 23:07:26 UTC (rev 105331)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2012-01-18 23:14:56 UTC (rev 105332)
@@ -146,7 +146,8 @@
         self._pretty_patch_path = self.path_from_webkit_base("Websites", "bugs.webkit.org", "PrettyPatch", "prettify.rb")
         self._pretty_patch_available = None
 
-        self.set_option_default('configuration', self.default_configuration())
+        if not options or not options.configuration:
+            self.set_option_default('configuration', self.default_configuration())
         self._test_configuration = None
         self._reftest_list = {}
         self._multiprocessing_is_available = (multiprocessing is not None)

Modified: trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations.py (105331 => 105332)


--- trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations.py	2012-01-18 23:07:26 UTC (rev 105331)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations.py	2012-01-18 23:14:56 UTC (rev 105332)
@@ -36,17 +36,12 @@
 from common import TabChecker
 from webkitpy.common.host import Host
 from webkitpy.layout_tests.models import test_expectations
+from webkitpy.layout_tests.port.base import DummyOptions
 
 
 _log = logging.getLogger(__name__)
 
 
-# FIXME: This could use mocktool.MockOptions(chromium=True) or base.DummyOptions(chromium=True) instead.
-class ChromiumOptions(object):
-    def __init__(self):
-        self.chromium = True
-
-
 class TestExpectationsChecker(object):
     """Processes test_expectations.txt lines for validating the syntax."""
 
@@ -57,12 +52,13 @@
             # I believe what this is trying to do is "when the port name is chromium,
             # get the chromium-port for this platform".  Unclear why that's needed??
             port_name = expectations_path.split(host.filesystem.sep)[-2]
-            if port_name == "chromium":
-                return host.port_factory.get(options=ChromiumOptions())
-            # Passing port_name=None to the factory would just return the current port, which isn't what we want, I don't think.
             if not port_name:
                 return None
-            return host.port_factory.get(port_name)
+
+            # Pass a configuration to avoid calling default_configuration() when initializing the port (takes 0.5 seconds on a Mac Pro!).
+            if port_name == "chromium":
+                return host.port_factory.get(options=DummyOptions(chromium=True, configuration="Release"))
+            return host.port_factory.get(port_name, options=DummyOptions(configuration="Release"))
         except Exception, e:
             _log.warn("Exception while getting port for path %s" % expectations_path)
             return None
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to