Skip to content
Back to skills

Compiler Explorer

ASecurity

Optimize functions by generating and analyzing compiler assembly output. Use when asked to optimize a function, analyze generated assembly, or improve performance by examining what the compiler produces.

  • 666 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added February 8, 2026
toolsrustgoc++bashperformance

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill compiler-explorer --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Compiler Explorer?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Compiler Explorer
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-compiler-explorer/badge)](https://www.skillsdirectory.com/skills/majiayu000-compiler-explorer)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: compiler-explorer
description: Optimize functions by generating and analyzing compiler assembly output. Use when asked to optimize a function, analyze generated assembly, or improve performance by examining what the compiler produces.
---

# Compiler Explorer

Optimize functions by analyzing compiler-generated assembly. This replicates the workflow of godbolt.org locally.

## Workflow

### 1. Isolate the Function

Create a standalone file with the function to optimize. Export it to prevent inlining:

```zig
export fn targetFunction(x: i64) i64 {
    // function body
}
```

```c
__attribute__((noinline)) int targetFunction(int x) {
    // function body
}
```

### 2. Generate Assembly

```bash
# Zig
zig build-obj src/target.zig -femit-asm -fno-emit-bin -O ReleaseFast

# C/C++ (clang)
clang -S -O3 -fno-inline -o target.s target.c

# Rust
rustc --emit=asm -C opt-level=3 target.rs
```

### 3. Locate and Read the Function

```bash
# Find the assembly file
find . -name "*.s" -newer src/target.zig

# Find function boundaries
grep -n "_targetFunction" output.s

# Count instructions
sed -n 'START,ENDp' output.s | grep -E '^\s+\w' | wc -l
```

### 4. Analyze and Iterate

Read through the assembly looking for:
- Unexpected instructions (type conversions, bounds checks, function calls)
- Repeated patterns that could be simplified
- Instructions that don't map to obvious source operations

Make a targeted change, regenerate assembly, compare instruction counts.

### 5. Benchmark

Always benchmark—fewer instructions ≠ always faster:

```bash
zig build-exe bench.zig -O ReleaseFast -o bench_v1
time ./bench_v1
```

Keep assembly outputs for comparison: `function_v1.s`, `function_v2.s`, etc.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.