From 1a0c67835cd74c6bf2113bb14a7f1b520508c536 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sun, 30 Mar 2025 20:41:26 -0600 Subject: measurestack: Cache QName.base() --- build-aux/measurestack/analyze.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'build-aux/measurestack/analyze.py') diff --git a/build-aux/measurestack/analyze.py b/build-aux/measurestack/analyze.py index 67edd5d..45ac876 100644 --- a/build-aux/measurestack/analyze.py +++ b/build-aux/measurestack/analyze.py @@ -56,9 +56,11 @@ class BaseName: class QName: _content: str + _base: BaseName | None def __init__(self, content: str) -> None: self._content = content + self._base = None def __str__(self) -> str: return self._content @@ -82,7 +84,9 @@ class QName: return hash(self._content) def base(self) -> BaseName: - return BaseName(self._content.rsplit(":", 1)[-1].split(".", 1)[0]) + if self._base is None: + self._base = BaseName(self._content.rsplit(":", 1)[-1].split(".", 1)[0]) + return self._base UsageKind: typing.TypeAlias = typing.Literal["static", "dynamic", "dynamic,bounded"] -- cgit v1.2.3-2-g168b