Commit 79aeb3b
committed
perf: Reduce allocations in file hash computation
Deduplicate range-bound string allocations in get_package_hashes —
compute format!("{}/", prefix) and format!("{}0", prefix) once
instead of twice per call (once for ls_tree, once for status). Also
compare using str slices instead of constructing RelativeUnixPathBuf
wrappers for the range bounds.
Use HashMap::entry API in calculate_file_hashes dedup loop to avoid
cloning the HashKey on cache hits. Previously, the key was constructed,
looked up with get(), and on miss cloned again for insert + push. Now
the entry API does one lookup and only clones into unique_keys on miss.1 parent fecc400 commit 79aeb3b
File tree
2 files changed
+24
-13
lines changed- crates
- turborepo-scm/src
- turborepo-task-hash/src
2 files changed
+24
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
193 | 204 | | |
194 | 205 | | |
195 | 206 | | |
196 | 207 | | |
197 | 208 | | |
198 | 209 | | |
199 | 210 | | |
200 | | - | |
201 | | - | |
202 | 211 | | |
203 | 212 | | |
204 | | - | |
205 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
206 | 217 | | |
207 | 218 | | |
208 | 219 | | |
| |||
216 | 227 | | |
217 | 228 | | |
218 | 229 | | |
219 | | - | |
220 | | - | |
221 | 230 | | |
222 | 231 | | |
223 | | - | |
224 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
225 | 236 | | |
226 | 237 | | |
227 | 238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
159 | | - | |
160 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
161 | 161 | | |
162 | | - | |
163 | | - | |
| 162 | + | |
| 163 | + | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| |||
0 commit comments