|
| 1 | +# dump-asm |
| 2 | + |
| 3 | +Generate assembly code for a benchmark and organize output into a baseline directory named after the current git branch. |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +``` |
| 8 | +/dump-asm <BenchmarkName> [<Framework>] |
| 9 | +``` |
| 10 | + |
| 11 | +## Arguments |
| 12 | + |
| 13 | +- `$ARGUMENTS` - The name of the benchmark class to run (e.g., `LruJustGetOrAdd`, `LfuJustGetOrAdd`, `SketchIncrement`), optionally followed by a target framework (e.g., `net9.0`, `net8.0`, `net6.0`) |
| 14 | + |
| 15 | +## Instructions |
| 16 | + |
| 17 | +This skill orchestrates benchmark assembly generation and organizes the output for comparison. |
| 18 | + |
| 19 | +Parse the arguments: the first argument is the benchmark name, and the optional second argument is the target framework. |
| 20 | + |
| 21 | +### Step 1: Clean artifacts |
| 22 | + |
| 23 | +Delete the BenchmarkDotNet.Artifacts directory to ensure a clean run: |
| 24 | + |
| 25 | +```bash |
| 26 | +rm -rf BenchmarkDotNet.Artifacts |
| 27 | +``` |
| 28 | + |
| 29 | +### Step 2: Run benchmark |
| 30 | + |
| 31 | +Run the bench-fast skill with the provided benchmark name and optional framework to generate assembly code. |
| 32 | + |
| 33 | +If a framework is specified, execute: |
| 34 | + |
| 35 | +```bash |
| 36 | +dotnet run -c Release --project BitFaster.Caching.Benchmarks --framework <Framework> --filter "<BenchmarkName>" -j short --warmupCount 3 --iterationCount 5 -d --disasmDepth 5 |
| 37 | +``` |
| 38 | + |
| 39 | +If no framework is specified, default to `net9.0`: |
| 40 | + |
| 41 | +```bash |
| 42 | +dotnet run -c Release --project BitFaster.Caching.Benchmarks --framework net9.0 --filter "<BenchmarkName>" -j short --warmupCount 3 --iterationCount 5 -d --disasmDepth 5 |
| 43 | +``` |
| 44 | + |
| 45 | +### Step 3: Split assembly files |
| 46 | + |
| 47 | +Run the split-asm skill to generate individual assembly code files: |
| 48 | + |
| 49 | +```bash |
| 50 | +dotnet run --project C:/repo/splitasm/splitasm -- BenchmarkDotNet.Artifacts/results |
| 51 | +``` |
| 52 | + |
| 53 | +### Step 4: Organize into baseline directory |
| 54 | + |
| 55 | +Get the current git branch name and convert it to a valid directory name by replacing forward slashes with dashes: |
| 56 | + |
| 57 | +```bash |
| 58 | +git rev-parse --abbrev-ref HEAD | tr '/' '-' |
| 59 | +``` |
| 60 | + |
| 61 | +For example, `users/alexpeck/foo` becomes `users-alexpeck-foo`. |
| 62 | + |
| 63 | +Create the baseline directory structure preserving the benchmark name and runtime hierarchy. For each benchmark and runtime combination found in `BenchmarkDotNet.Artifacts/results/`: |
| 64 | + |
| 65 | +1. Extract the short benchmark name from the full benchmark path (e.g., `BitFaster.Caching.Benchmarks.LruJustGetOrAdd` → `LruJustGetOrAdd`) |
| 66 | +2. Create the directory `baseline/<sanitized-branch-name>/<benchmarkname>/<runtime>/` |
| 67 | +3. Copy all files from the corresponding `BenchmarkDotNet.Artifacts/results/<full-benchmark-name>/<runtime>/` directory |
| 68 | + |
| 69 | +The final structure should be: |
| 70 | +``` |
| 71 | +baseline/ |
| 72 | + <sanitized-branch-name>/ |
| 73 | + <benchmarkname>/ |
| 74 | + <runtime>/ |
| 75 | + <MethodName>-asm.md |
| 76 | + <MethodName>-summary.md |
| 77 | + ... |
| 78 | +``` |
| 79 | + |
| 80 | +For example: |
| 81 | +``` |
| 82 | +baseline/ |
| 83 | + users-alexpeck-skills/ |
| 84 | + LruJustGetOrAdd/ |
| 85 | + .NET 6.0.36 (6.0.3624.51421), X64 RyuJIT AVX2/ |
| 86 | + FastConcurrentLru-asm.md |
| 87 | + FastConcurrentLru-summary.md |
| 88 | + ... |
| 89 | +``` |
0 commit comments