summaryrefslogtreecommitdiff
path: root/build-aux/measurestack/analyze.py
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-03-31 15:58:51 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-04-01 05:09:44 -0600
commit2ced5e02eacfc6b9e67435fe3a24dcb6c3a29037 (patch)
treea228eef90a7000c80dab582630b85d04dac923ee /build-aux/measurestack/analyze.py
parent1a0c67835cd74c6bf2113bb14a7f1b520508c536 (diff)
measurestack: Compile all regexes upfront
Diffstat (limited to 'build-aux/measurestack/analyze.py')
-rw-r--r--build-aux/measurestack/analyze.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/build-aux/measurestack/analyze.py b/build-aux/measurestack/analyze.py
index 45ac876..871ff2d 100644
--- a/build-aux/measurestack/analyze.py
+++ b/build-aux/measurestack/analyze.py
@@ -133,6 +133,16 @@ class Application(typing.Protocol):
def skip_call(self, chain: typing.Sequence[QName], funcname: QName) -> bool: ...
+re_node_label = re.compile(
+ r"(?P<funcname>[^\n]+)\n"
+ + r"(?P<location>[^\n]+:[0-9]+:[0-9]+)\n"
+ + r"(?P<nstatic>[0-9]+) bytes \((?P<usage_kind>static|dynamic|dynamic,bounded)\)\n"
+ + r"(?P<ndynamic>[0-9]+) dynamic objects"
+ + r"(?:\n.*)*",
+ flags=re.MULTILINE,
+)
+
+
def analyze(
*,
ci_fnames: typing.Collection[str],
@@ -140,15 +150,6 @@ def analyze(
app: Application,
cfg_max_call_depth: int,
) -> AnalyzeResult:
- re_node_label = re.compile(
- r"(?P<funcname>[^\n]+)\n"
- + r"(?P<location>[^\n]+:[0-9]+:[0-9]+)\n"
- + r"(?P<nstatic>[0-9]+) bytes \((?P<usage_kind>static|dynamic|dynamic,bounded)\)\n"
- + r"(?P<ndynamic>[0-9]+) dynamic objects"
- + r"(?:\n.*)*",
- flags=re.MULTILINE,
- )
-
graph: dict[QName, Node] = {}
qualified: dict[BaseName, set[QName]] = {}