Skip to content

TsukiNi22/ai-utils / skills/audit/benchmark

benchmark

Verified

Benchmark and profile the current program (C / C++ first, also Rust and Python) with the tools available (perf stat / record / report, hyperfine, valgrind callgrind / massif, heaptrack, flame graphs), asking before installing a missing tool - optimized build with symbols in a copy, wall time, hardware counters, hot functions (self and inclusive), hot lines, memory - then the analysis of what is slow and why, each finding classified as a quick win or a complex change with its estimated gain, delivered as a PDF / Markdown report (report skill), and optionally the optimizations with a before / after comparison. Use whenever the user asks for a benchmark, a profiling, a performance analysis, what is slow, which function takes the time, or how to optimize a program.

FileKindSize
SKILL.mdskill md6.8 KB
requires.txtmarkdown7 B
scripts/hotspots.pyexecutablescript8.7 KB
scripts/profile.shexecutablescript6.7 KB
scripts/tools.shexecutablescript2.4 KB

scripts/tools.sh

View on GitHub
#!/bin/bash
# Profiling tools available on this computer, and how to install the missing ones.
#
# Usage: tools.sh
#
# One line per tool: "<tool> ok <version>" | "<tool> missing <install command>", then the perf permission level.

set -uo pipefail # no -e: the probes of the missing tools fail on purpose (xstyle: ignore-file SH-STRICT)

# Package manager of the OS
if command -v dnf > /dev/null 2>&1; then
    PM="dnf"
elif command -v apt-get > /dev/null 2>&1; then
    PM="apt"
else
    PM=""
fi

# <tool> <command> <dnf package> <apt package> <what for>
TOOLS=(
    "perf|perf|perf|linux-tools-common linux-tools-$(uname -r)|sampling profiler: hot functions, call graph, hardware counters"
    "hyperfine|hyperfine|hyperfine|hyperfine|wall time with warmup, mean / stddev over many runs"
    "valgrind|valgrind|valgrind|valgrind|callgrind (exact instruction counts per function / line) and massif (heap)"
    "heaptrack|heaptrack|heaptrack|heaptrack|allocations: hot allocation sites, peak memory, leaks"
    "flamegraph|flamegraph.pl|flamegraph flamegraph-stackcollapse-perf|flamegraph|flame graph SVG from perf (FlameGraph scripts)"
    "time|/usr/bin/time|time|time|peak memory (max RSS) of a run"
    "py-spy|py-spy|-|-|Python sampling profiler (pip install --user py-spy)"
)

for entry in "${TOOLS[@]}"; do
    IFS='|' read -r name command dnf apt why <<< "$entry"
    if command -v "$command" > /dev/null 2>&1 || [[ -x "$command" ]]; then
        version="$("$command" --version 2> /dev/null | head -1 || true)"
        printf "%-10s ok       %s\n" "$name" "${version:-installed}"
        continue
    fi
    case "$PM" in
        dnf) install="sudo dnf install -y $dnf" ;;
        apt) install="sudo apt-get install -y $apt" ;;
        *) install="see the documentation of $name" ;;
    esac
    [[ "$dnf" == "-" ]] && install="pip install --user $name"
    printf "%-10s missing  %s   # %s\n" "$name" "$install" "$why"
done

# perf needs perf_event_paranoid <= 2 for the user space events of our own processes
paranoid="$(cat /proc/sys/kernel/perf_event_paranoid 2> /dev/null || echo "?")"
if [[ "$paranoid" == "?" ]]; then
    echo "perf_event_paranoid: unknown"
elif (( paranoid > 2 )); then
    echo "perf_event_paranoid: $paranoid (too high: sudo sysctl kernel.perf_event_paranoid=2, until the next reboot)"
else
    echo "perf_event_paranoid: $paranoid (ok: user space events, kernel symbols hidden when 2)"
fi
canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.Stars: 197kUpdated Claude CodeCodexVerifiedInstall