Skip to content

Commit 6bb5239

Browse files
morningmanclaude
andcommitted
[opt](build) Note unity batching in rebuild_radius.py output
rebuild_radius.py counts, per header, how many object targets depend on it. A unity build answers that question at batch granularity: the 51 InformationSchema scanners become one object, so a header they all include reports 1 dependent instead of 51. The number is correct for that configuration but not comparable with a per-file run, which is how the tool is normally used. Say so in the output when unity objects are present, rather than letting the count quietly change meaning. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Gdfkk7RqgD5e3Uv7bTM3NV
1 parent 90d33da commit 6bb5239

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎build-support/compile-bench/rebuild_radius.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,15 @@ def main():
7272
counts = {h: 0 for h in headers}
7373
pch_deps = set()
7474
objects = 0
75+
unity_objects = 0
7576

7677
proc = subprocess.Popen(["ninja", "-C", args.build_dir, "-t", "deps"],
7778
stdout=subprocess.PIPE, text=True, errors="replace",
7879
bufsize=1 << 20)
7980
target, target_is_pch, hits = None, False, set()
8081

8182
def flush():
82-
nonlocal objects
83+
nonlocal objects, unity_objects
8384
if target is None:
8485
return
8586
if target_is_pch:
@@ -89,6 +90,8 @@ def flush():
8990
counts[h] += 1
9091
if target.endswith((".o", ".obj")):
9192
objects += 1
93+
if "/Unity/unity_" in target:
94+
unity_objects += 1
9295

9396
for line in proc.stdout:
9497
if line[:1] not in (" ", "\t", "\n"):
@@ -105,6 +108,10 @@ def flush():
105108
proc.wait()
106109

107110
print(f"{objects:,} object targets in the deps database\n")
111+
if unity_objects:
112+
print(f"note: {unity_objects:,} of them are unity TUs, so the sources they batch "
113+
"count once per\n batch instead of once per file. For per-file counts "
114+
"rebuild with ENABLE_UNITY_BUILD=OFF.\n")
108115
print(f"{'header':58s} {'dependents':>10s} via PCH (= rebuilds everything)")
109116
for h in headers:
110117
flag = "YES" if h in pch_deps else "no"

0 commit comments

Comments
 (0)