mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1158898 - Cache config.guess output; r=mshal
mach dispatch makes separate, independent calls to construct build system state. Part of this resolution is determining the object directory. For environments without an object directory defined, we must execute config.guess to determine the object directory. This redundant execution of config.guess can result in significant execution overhead. Before this patch, `mach help` with no mozconfig took ~1.5s on my OS X machine. After this patch, it goes down to ~0.750s. On Windows, the difference is even more pronounced, with execution time dropping from 8.5s to 0.930s.
This commit is contained in:
parent
ed6ca74f4f
commit
0efde2ed68
@ -28,6 +28,9 @@ from .mozconfig import (
|
||||
from .virtualenv import VirtualenvManager
|
||||
|
||||
|
||||
_config_guess_output = []
|
||||
|
||||
|
||||
def ancestors(path):
|
||||
"""Emit the parent directories of a path."""
|
||||
while path:
|
||||
@ -353,6 +356,11 @@ class MozbuildObject(ProcessExecutionMixin):
|
||||
if config_guess:
|
||||
return config_guess
|
||||
|
||||
# config.guess results should be constant for process lifetime. Cache
|
||||
# it.
|
||||
if _config_guess_output:
|
||||
return _config_guess_output[0]
|
||||
|
||||
p = os.path.join(topsrcdir, 'build', 'autoconf', 'config.guess')
|
||||
|
||||
# This is a little kludgy. We need access to the normalize_command
|
||||
@ -362,7 +370,9 @@ class MozbuildObject(ProcessExecutionMixin):
|
||||
o = MozbuildObject(topsrcdir, None, None, None)
|
||||
args = o._normalize_command([p], True)
|
||||
|
||||
return subprocess.check_output(args, cwd=topsrcdir).strip()
|
||||
_config_guess_output.append(
|
||||
subprocess.check_output(args, cwd=topsrcdir).strip())
|
||||
return _config_guess_output[0]
|
||||
|
||||
def notify(self, msg):
|
||||
"""Show a desktop notification with the supplied message
|
||||
|
Loading…
Reference in New Issue
Block a user