Finds a valid optimization target in lading. Returns a filled target.yaml template with pattern, technique, target, file, bench, and fingerprint. Use before /lading-optimize-hunt or when selecting a new optimization target.
84
81%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
A module is eligible if it has a Criterion benchmark in lading_payload/benches/.
lading_payload/benches/*.rs — each filename (minus .rs) is a bench namelading_payload/src/. Check single-file modules ({name}.rs), directory modules ({name}/), and parent-module patterns (e.g., opentelemetry_log → opentelemetry/log.rs)ci/fingerprints/*/lading.yaml — each directory name is a fingerprint. Match fingerprints to modules by reading the variant: key from each configThe result is a set of (bench, source_files, fingerprint_or_none) triples.
Run the profiling script:
.claude/skills/lading-optimize-find-target/scripts/profile-modulesOutput is TSV: module, allocations, total_bytes, peak_live_bytes. Record per-module.
Read the optimization history to understand what techniques work and what's already done:
Read .claude/skills/lading-optimize-hunt/assets/db.yamlFor each entry, read its detail file (file: field, relative to .claude/skills/lading-optimize-hunt/) to extract:
This history teaches you what to look for. Successful past techniques are strong signals for where to look next. The lessons field often suggests next targets explicitly.
Scan every benchmark-eligible source module for every known pattern below. This is an exhaustive cross-product — do not short-circuit after finding one hit.
| Name | Pattern | Technique |
|---|---|---|
vec-with-capacity | Vec::new() + repeated push | Vec::with_capacity(n) |
string-with-capacity | String::new() + repeated push | String::with_capacity(n) |
map-with-capacity | FxHashMap::default() hot insert | FxHashMap::with_capacity(n) |
buffer-reuse | format!() in hot loop | write!() to reused buffer |
slice-params | &Vec<T> or &String parameter | &[T] or &str slice |
hoist-allocation | Allocation in hot loop | Move allocation outside loop |
object-pool | Repeated temp allocations | Object pool / buffer reuse |
borrow-not-clone | Clone where borrow works | Use reference |
inline | Hot cross-crate fn call | #[inline] attribute |
lazy-iterators | Intermediate .collect() calls | Iterator chains without collect |
box-large-structs | Large struct by value | Box or reference |
bounded-buffer | Unbounded growth | Bounded buffer with .clear() |
scratch-buffer | encode_to_vec() per call | Reusable BytesMut scratch buffer |
on-demand-serialization | Deep clone of template in loop | Incremental mutation / COW |
Step 1 — Read source files. For each module's source file(s), Read the full file (excluding #[cfg(test)] blocks). Understand the data flow: what structs exist, how serialization works, where the hot path is, and what allocations occur.
Step 2 — Identify patterns. For each module, check whether any of the Known Patterns above apply. Record a hit matrix:
module × pattern → match count (0 = no hit)Show the full matrix as a table. Every cell must have a value. Do NOT skip any combination.
Step 3 — Record opportunities. Each verified hot-path hit becomes an opportunity:
(pattern, technique, target_function, file, module, allocations_from_profiling)
Remove any opportunity that:
.claude/skills/lading-optimize-hunt/assets/db.yaml — same function + semantically equivalent technique already existslading_payload/benches/If zero survive, STOP: "No valid optimization targets found."
Sort by two dimensions:
.claude/skills/lading-optimize-hunt/assets/db.yaml rank higher (compute avg % improvement from measurements.benchmarks.macro). Unknown techniques rank last.Sort by technique impact first, allocation intensity second.
Tiebreaker: Prefer modules with no prior .claude/skills/lading-optimize-hunt/assets/db.yaml entries, then alphabetical file name.
Show sorted results in a table.
Pick the top-ranked opportunity. Return as a fenced YAML code block. Do NOT write to disk. Do not include intermediate tables, matrices, or analysis.
pattern: "<description of the code pattern found>"
technique: "<pattern name / optimization technique to apply>"
target: "<Module::function>"
file: "<relative path to source file>"
bench: "<relative path to Criterion benchmark .rs file>"
fingerprint: "<relative path to fingerprint lading.yaml config, or null>"01ef8d7
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.