diff options
| author | Eli Schwartz <eschwartz93@gmail.com> | 2023-12-11 12:49:43 -0500 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2023-12-11 21:13:20 +0200 |
| commit | ff7a997f484deda3e355e5697eea220d6001814b (patch) | |
| tree | 551bd636602a9383d690837aa9313b1e4a0fc188 | |
| parent | d8a6bf9352ebc0be84be4337ee1cecfa840ab1f0 (diff) | |
| download | meson-ff7a997f484deda3e355e5697eea220d6001814b.tar.gz | |
xcode backend: make the type of get_target_dir align with parent class
mypy will complain if backends.Backend has a lru_cache wrapped method,
but it is overridden in XCodeBackend with a method that isn't cached.
This is almost certainly a sign that we should be caching it here too
anyway. The generic backend cache was added years ago via an
intimidating commit f39d2cc3bfa1dd4983cbe5adfb6c6e87dd09d684 which
claims that it reduced call time from 60s to 0.000435s and that this was
specifically due to getting a coredata option every single time. This is
probably workload dependent, but getting an option is *not* nearly as
cheap as a throwaway function call.
| -rw-r--r-- | mesonbuild/backend/xcodebackend.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py index 104527a91..7d77b4fb0 100644 --- a/mesonbuild/backend/xcodebackend.py +++ b/mesonbuild/backend/xcodebackend.py @@ -13,7 +13,7 @@ # limitations under the License. from __future__ import annotations -import uuid, os, operator +import functools, uuid, os, operator import typing as T from . import backends @@ -226,6 +226,7 @@ class XCodeBackend(backends.Backend): def gen_id(self) -> str: return str(uuid.uuid4()).upper().replace('-', '')[:24] + @functools.lru_cache(maxsize=None) def get_target_dir(self, target): dirname = os.path.join(target.get_subdir(), T.cast('str', self.environment.coredata.get_option(OptionKey('buildtype')))) #os.makedirs(os.path.join(self.environment.get_build_dir(), dirname), exist_ok=True) |
