summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-03-30 20:41:26 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-03-31 15:35:09 -0600
commit1a0c67835cd74c6bf2113bb14a7f1b520508c536 (patch)
treef9cb94661188fa24daa814eba7bd36d11c0e7330
parente5907d69a9d1263e056a214e93e326dbe8243e15 (diff)
measurestack: Cache QName.base()
-rw-r--r--build-aux/measurestack/analyze.py6
1 files changed, 5 insertions, 1 deletions
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"]