perf(apple): stop repeating the archive path in Interface Builder evidence (#1460)
Every Interface Builder node and edge evidence record prefixed its description with the archive's relative path, which artifact_path in the same record already states. Bundles carry thousands of objects across localized nibs, so the repeated path made up 6-10% of decode_interface_builder output (XLD: 7.38 MB to 6.62 MB). Descriptions now name only the decoded item, such as "object 81" or "outlet o_quality". Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ef96657d6b
commit
b118f04492
@@ -509,3 +509,46 @@ describe("AppKit keyed archive connectors", () => {
|
||||
expect(to).toEqual(expect.arrayContaining(["objc_selector", "unknown"]));
|
||||
});
|
||||
});
|
||||
|
||||
it("names the archive once per evidence record", () => {
|
||||
const relativePath = "Views/Main.storyboardc/scene.nib/objects.nib";
|
||||
const result = buildInterfaceBuilderAnalysis({
|
||||
targetSha256: hash,
|
||||
toolVersion: "test",
|
||||
documents: [
|
||||
{
|
||||
relativePath,
|
||||
archiveSha256: hash,
|
||||
documentKind: "storyboard_scene",
|
||||
raw: {
|
||||
"com.apple.ibtool.document.objects": {
|
||||
controller: { customClass: "StoreViewController" },
|
||||
next: { customClass: "BuildViewController" },
|
||||
},
|
||||
"com.apple.ibtool.document.connections": {
|
||||
controller: [
|
||||
{ type: "segue", identifier: "showBuild", destinationId: "next" },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
limits: interfaceBuilderLimitsSchema.parse({}),
|
||||
});
|
||||
const evidence = [...result.graph.nodes, ...result.graph.edges].flatMap(
|
||||
(item) => item.evidence,
|
||||
);
|
||||
expect(new Set(evidence.map(({ artifact_path }) => artifact_path))).toEqual(
|
||||
new Set([relativePath]),
|
||||
);
|
||||
expect(evidence.map(({ description }) => description)).toEqual(
|
||||
expect.arrayContaining([
|
||||
"compiled document",
|
||||
"object controller",
|
||||
"segue showBuild",
|
||||
]),
|
||||
);
|
||||
expect(
|
||||
evidence.filter(({ description }) => description.includes(relativePath)),
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
@@ -72,7 +72,9 @@ export const buildInterfaceBuilderAnalysis = (input: {
|
||||
const evidenceFor = (description: string) => [
|
||||
{
|
||||
kind: "interface_builder_resource" as const,
|
||||
description: `${document.relativePath}: ${description}`,
|
||||
// artifact_path names the archive; repeating it here cost a path per
|
||||
// node and edge.
|
||||
description,
|
||||
location: { address: null, file_offset: null },
|
||||
artifact_path: document.relativePath,
|
||||
artifact_sha256: document.archiveSha256,
|
||||
|
||||
Reference in New Issue
Block a user