feat: add benchmarking and profiling infrastructure#6
Conversation
37a4210 to
b64f06d
Compare
Add comprehensive benchmarking and profiling support for leantar: **New binaries:** - `leantar-benchmark`: Benchmark tool with manifest-based reproducible runs - `--create-manifest <TAG>`: Generate manifest from mathlib tag - `--sweep`: Test different thread counts to find optimal parallelism - `--json`: Machine-readable output - `-l/--limit`: Limit files for quick tests **Profiling:** - New `profile` module with atomic counters for lock-free metrics - Detailed timing breakdown: read, zstd init, decompress, file I/O - Byte counters for compressed/decompressed data - File type counters (zstd, lgz, lgz_module, hash variants) **Instrumentation:** - `ltar.rs`: Fine-grained profiling of all unpack operations - `tar.rs`: Wall-clock timing and profile report output 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
b64f06d to
1762673
Compare
Apply fn_single_line, match_arm_blocks, trailing_semicolon, and where_single_line formatting options from rustfmt.toml. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Fixes clippy::lines_filter_map_ok warning - filter_map() could run forever if the iterator repeatedly produces Err on a read error. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Replace table-like ASCII formatting with simpler text output that doesn't have alignment issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
| eprintln!(); | ||
| eprintln!("To create a manifest for a specific mathlib version:"); | ||
| eprintln!(" leantar-benchmark --create-manifest v4.26.0-rc1"); | ||
| eprintln!(" leantar-benchmark --create-manifest v4.26.0-rc2"); |
There was a problem hiding this comment.
Should I be worried about this being something to update all the time?
There was a problem hiding this comment.
It's only in a help message that a user is meant to copy, so I'd hope that they update it as they prefer (or that it just doesn't matter).
We could also change this to e.g. stable.
I'm not actually particularly sure we want to merge this --- I'd like to get to the bottom of slow decompression on macos, and Jireh's reports of intermittent single-threaded behaviour, but hopefully we can collect the data just by people using the PR. The actual code in this PR is entirely AI generated and I don't particular want to have to read it / vouch for it.
There was a problem hiding this comment.
I was going to suggest the same. If the PR alone is good enough for you, then I think I would prefer not to merge it for now.
The --create-manifest command was downloading cache files to a temp directory and then deleting them, causing --sweep to fail because the .ltar files no longer existed. Now: - Cache files are downloaded to benchmarks/cache-<tag>/ (persistent) - The cache path is stored in the manifest header - Benchmarks read the cache path from the manifest by default - Users can override with their system cache (~/.cache/mathlib) for in-situ benchmarking 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Closing per @digama0's preference — thanks for the review. |
See #mathlib4 > lake exe cache get very slow @ 💬, where I discovered that setting the parallelism significantly lower than the number of CPUs gives much better throughput. Needs testing now on other machines.
No particular need to merge this, we can benchmark from the branch.
Add comprehensive benchmarking and profiling support for leantar:
New
leantar-benchmarkbinary for reproducible performance testing--create-manifest <TAG>: Generate manifest from mathlib tag (writes to./benchmarks/)--sweep: Test different thread counts to find optimal parallelism--json: Machine-readable output for CI integration-l/--limit: Limit files for quick testsNew
profilemodule with atomic counters for lock-free metricsInstrumentation in
ltar.rswith fine-grained profiling of all unpack operationsProfile reporting in
tar.rswith wall-clock timing and breakdown🤖 Prepared with Claude Code