git import: stop after N commits, and time each commit, for measuring 810691ca6ce6
OXY_IMPORT_STOP_AFTER ends an import cleanly after that many commits so its timings are reported; the trace line now gives each commit's time. Used on a recovered copy of the VS Code import at 118k commits: merges take 85% of the time. refs #80
- Author
- Andy McCall @andymccall <[email protected]>
- When
- · 2026-10-06 20:47 UTC
- Signature
- ✔ signed by Andy McCall
- Hash
810691ca6ce6ac7f170478d8e5d1381d869823e2fbb5137f7e6377a421fa523e- Depends on
- 30ea9c1e70fa 58dfe0e134eb 79ab8528ff62 9935d490ddfb d45dab0484ea fb5b6181618a
- Depended on by
- d256e826ac5d 579afd107b9b ce118287d9da
- In bookmarks
- bare-hashes carried-not-removed carry-identical doctor-trust identical-sides keyless-tags main merge-remote-bookmark only-help-103 paths-for-resolutions-and-amend push-notes show-stat subrepo-pin-state switch-says
- In tags
- v0.10.0 v0.11.0 v0.4.1 v0.4.2 v0.4.3 v0.4.4 v0.4.5 v0.4.6 v0.5.0 v0.5.1 v0.6.0 v0.7.0 v0.8.0 v0.9.0
- Edits
- 6 atoms, 0 tree operations, 1 file
Browse the tree at this change
modified crates/oxy-core/src/repo/git.rs +12 −2
| … | 813 unchanged lines |
||
| 814 | 814 | .and_then(|v| v.parse().ok()) |
|
| 815 | 815 | .filter(|n| *n > 0) |
|
| 816 | 816 | .unwrap_or(CHECKPOINT_COMMITS); |
|
| 817 | + | // OXY_IMPORT_STOP_AFTER ends the import cleanly after that many |
|
| 818 | + | // commits, its timings reported, for measuring at depth. |
|
| 819 | + | let stop_after: Option<usize> = std::env::var("OXY_IMPORT_STOP_AFTER") |
|
| 820 | + | .ok() |
|
| 821 | + | .and_then(|v| v.parse().ok()); |
|
| 817 | 822 | let total = commits.len(); |
|
| 818 | 823 | for (index, gc) in commits.iter().enumerate() { |
|
| 819 | 824 | if known.imported.contains_key(&gc.sha) || known.exported.contains_key(&gc.sha) { |
|
| 820 | 825 | continue; |
|
| 826 | + | } |
|
| 827 | + | if stop_after.is_some_and(|n| done >= n) { |
|
| 828 | + | break; |
|
| 821 | 829 | } |
|
| 830 | + | let commit_started = std::time::Instant::now(); |
|
| 822 | 831 | if index % 500 == 0 { |
|
| 823 | 832 | progress(&format!( |
|
| 824 | 833 | "{index} of {total} commits, {} merges; at {} {}", |
|
| … | 424 unchanged lines |
||
| 1249 | 1258 | .map(|(st, _)| st.built_atoms()) |
|
| 1250 | 1259 | .unwrap_or(0); |
|
| 1251 | 1260 | eprintln!( |
|
| 1252 | - | "trace {done} {} parents={} base={base_how} merged={merged} built={built} atoms={atoms} kept={} shed={shed} rss_mb={} before_trim_mb={before_trim} deferred_edits={edits} most={most}", |
|
| 1261 | + | "trace {done} {} parents={} base={base_how} merged={merged} built={built} atoms={atoms} kept={} shed={shed} rss_mb={} before_trim_mb={before_trim} deferred_edits={edits} most={most} ms={}", |
|
| 1253 | 1262 | &gc.sha[..12.min(gc.sha.len())], |
|
| 1254 | 1263 | gc.parents.len(), |
|
| 1255 | 1264 | kept.len(), |
|
| 1256 | - | rss_mb() |
|
| 1265 | + | rss_mb(), |
|
| 1266 | + | commit_started.elapsed().as_millis() |
|
| 1257 | 1267 | ); |
|
| 1258 | 1268 | } |
|
| 1259 | 1269 | } |
|
| … | 549 unchanged lines |