Isurwars/Correlation / .agents/skills/benchmarking
benchmarking
VerifiedEnforce data-oriented design (SoA vs AoS), SIMD vectorization, Google Benchmark microbenchmarks, and cache-line alignment. Use when profiling or optimizing throughput and latency.
Microbenchmarking & Performance Optimization
This skill governs high-performance C++ execution, memory-locality optimizations, SIMD vectorization contracts, and microbenchmarking protocols across Correlation.
1. Memory Locality & Data-Oriented Design (DOD)
- Contiguous Memory First: Prefer
std::vector,std::array, or contiguousstd::spanbuffers over pointer-chasing structures (std::list, raw pointer arrays, node-based trees). - SoA vs AoS Layout Selection:
- Array of Structures (AoS): Suitable for scalar access or non-vectorized operations (
struct Atom { Vector3D pos; Vector3D vel; double mass; };). - Structure of Arrays (SoA): Required for high-throughput SIMD vector loops (
struct AtomBuffer { std::vector<float> x, y, z; };) to ensure stride-1 sequential memory access and alignment.
- Array of Structures (AoS): Suitable for scalar access or non-vectorized operations (
- Cache Line Alignment (
alignas(64)):- Align thread-local accumulator structures to 64 bytes (
alignas(64)) to eliminate false sharing in multi-threaded OpenMP/TBB reduction loops.
- Align thread-local accumulator structures to 64 bytes (
// GOOD: Cache-line aligned thread-local accumulator
struct alignas(64) ThreadLocalHistogram {
std::vector<uint64_t> bins;
};
2. SIMD Vectorization Contracts
- Vector-Friendly Loops: Keep inner distance/histogram computation loops free of conditional branching (
if/else), virtual function calls, or complex control flow. - Contiguous Access: Ensure pointer reads inside inner loops process contiguous memory blocks without strided pointer indirection.
- Use SIMD Intrinsics / Wrappers: Prefer vectorized SIMD wrappers (
Vector3SIMD,dot_block) or standard C++23std::spanover custom assembly instructions unless profiling explicitly demonstrates auto-vectorization failure.
3. Microbenchmarking Protocol (Google Benchmark)
- Dead-Code Elimination Guard: Wrap benchmarked output variables in
benchmark::DoNotOptimize(...)and callbenchmark::ClobberMemory()to prevent compiler optimization passes from discarding calculated values.
#include <benchmark/benchmark.h>
static void BM_RadialDistribution(benchmark::State& state) {
auto trajectory = create_test_trajectory();
RDFCalculator calculator;
for (auto _ : state) {
auto result = calculator.calculate(trajectory);
benchmark::DoNotOptimize(result);
benchmark::ClobberMemory();
}
}
BENCHMARK(BM_RadialDistribution);
- Isolation & Statistical Rigor:
- Run benchmarks under Release builds with target architecture flags (
-O3 -march=native). - Ensure benchmark targets are reproducible and isolated from external I/O operations.
- Run benchmarks under Release builds with target architecture flags (
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |