This repository was archived by the owner on May 12, 2026. It is now read-only.
Commit c66d495
perf: optimize artifact state collection and remove redundant APK hashing
Refactor artifact state collection into a single filesystem traversal to reduce repeated IO and metadata work during diff report generation.
Key changes:
- Replace three independent scans (files/build.props/apks) with one _collect_state_entries pass.
- Reuse per-file size/sha256 for APK metadata to avoid hashing APK files twice.
- Cache aapt tool resolution with lru_cache so tool probing occurs once per process.
- Keep diff report schema unchanged while improving runtime efficiency for large target trees.
Tests:
- Add regression test to ensure each file is hashed exactly once during collect_artifact_state.
- Existing diff-report behavior test remains green.
Verification:
- .venv/bin/python -m ruff check src/app/diff_report.py tests/test_diff_report.py
- .venv/bin/python -m mypy --config-file mypy-curated.ini
- .venv/bin/python -m pytest -q tests/test_diff_report.py
- .venv/bin/python -m pytest -q
Co-authored-by: OpenAI Codex <noreply@openai.com>1 parent 183c963 commit c66d495
2 files changed
Lines changed: 81 additions & 56 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | 48 | | |
60 | 49 | | |
61 | 50 | | |
| |||
68 | 57 | | |
69 | 58 | | |
70 | 59 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
79 | 66 | | |
80 | 67 | | |
81 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
82 | 72 | | |
83 | | - | |
84 | | - | |
| 73 | + | |
| 74 | + | |
85 | 75 | | |
86 | 76 | | |
87 | 77 | | |
88 | 78 | | |
89 | 79 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
100 | 83 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
113 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
114 | 101 | | |
115 | 102 | | |
116 | 103 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
121 | 113 | | |
122 | | - | |
123 | | - | |
124 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
125 | 127 | | |
126 | 128 | | |
127 | 129 | | |
| |||
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
| 137 | + | |
135 | 138 | | |
136 | 139 | | |
137 | | - | |
138 | | - | |
139 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
140 | 143 | | |
141 | 144 | | |
142 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
0 commit comments