loop-optimizer
Skill17 starsChanged 9 months agoApache-2.0View on GitHub
Optimize loops through transformations like unrolling, fusion, tiling, and vectorization.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- zedarvates/frugal-skillstheir own version, first seen Nov 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- zedarvates/frugal-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository98 other files it gives its agents.
- abstract-interpretation-engineSkill
- abstract-machineSkill
- acsl-annotation-assistantSkill
- actor-model-implementerSkill
- algebraic-effectsSkill
- alias-and-points-to-analysisSkill
- axiomatic-semanticsSkill
- bidirectional-type-checkingSkill
- bisimulation-checkerSkill
- capability-systemSkill
- closure-converterSkill
- common-subexpression-eliminatorSkill
- concurrency-verifierSkill
- constant-propagation-passSkill
- contextual-equivalenceSkill
- control-flow-analysisSkill
- coq-proof-assistantSkill
- cps-transformerSkill
- dafny-verifierSkill
- dataflow-analysis-frameworkSkill
- dead-code-eliminatorSkill
- defunctionalizationSkill
- denotational-semantics-builderSkill
- dependent-type-implementerSkill
- dsl-embeddingSkill
- effect-handlers-implementerSkill
- effect-systemSkill
- effect-type-systemSkill
- escape-analysisSkill
- existential-typesSkill
- ffi-designerSkill
- fuzzer-generatorSkill
- gadt-implementerSkill
- garbage-collector-implementerSkill
- graalvm-truffle-implementerSkill
- gradual-typing-implementerSkill
- higher-order-abstract-syntaxSkill
- hoare-logic-verifierSkill
- incremental-computationSkill
- information-flow-analyzerSkill
- inline-expanderSkill
- interprocedural-analysisSkill
- invariant-generatorSkill
- jit-compiler-builderSkill
- lambda-calculus-interpreterSkill
- language-server-protocolSkill
- lean-proverSkill
- lexer-generatorSkill
- linear-type-implementerSkill
- liveness-analysisSkill
- llvm-backend-generatorSkill
- lock-free-data-structureSkill
- loop-termination-proverSkill
- macro-expanderSkill
- memory-allocatorSkill
- message-passing-systemSkill
- mlir-dialect-designerSkill
- model-checkerSkill
- module-systemSkill
- monad-transformerSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 44
Consider unrolling factor carefully (code size vs.
- Distinctive: line 86
When code size matters more than speed
- Distinctive: line 87
When loops have complex control flow
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Loop Optimizer
Loop optimizations transform loops to improve performance by reducing overhead, increasing parallelism, and improving cache locality. Since programs spend most time in loops, these optimizations are critical for performance.
When to Use This Skill
- Building optimizing compilers
- Improving numerical code performance
- Enabling vectorization
- Optimizing for cache hierarchy
- Parallelizing loop nests
What This Skill Does
- Loop Unrolling: Replicate loop body to reduce branch overhead
- Loop Fusion: Combine multiple loops into one
- Loop Tiling: Reorganize iteration for cache locality
- Loop Vectorization: Transform for SIMD execution
- Loop Interchange: Reorder nested loops for memory access
Key Concepts
| Concept | Description |
| Loop Unrolling | Replicate body to reduce branch overhead |
| Loop Fusion | Combine loops with same bounds |
| Loop Tiling | Reorganize for cache blocks |
| Loop Interchange | Swap nested loop order |
| Vectorization | Execute multiple iterations in parallel |
Tips
- Profile before optimizing (identify hot loops)
- Consider unrolling factor carefully (code size vs. speed)
- Tile for L1 cache size (typically 32KB)
- Align data for vectorization
- Combine transformations synergistically
Common Use Cases
- Matrix operations (multiply, transpose)
- Image processing kernels
- Scientific computing
- Machine learning operators
- Compression/decompression
Related Skills
dataflow-analysis-framework- Dependency analysisconstant-propagation-pass- Combine with loop optimizationsllvm-backend-generator- LLVM loop passesssa-constructor- Loop in SSA form
Canonical References
| Reference | Why It Matters |
| Lam, Rothberg & Wolf, "The Cache Performance and Optimizations of Blocked Algorithms" (PLDI 1991) | Classic paper on tiling for cache locality |
| Wolf & Lam, "A Data Locality Optimizing Algorithm" (PLDI 1991) | Unified loop transformation framework |
| Allen & Kennedy, "Optimizing Compilers for Modern Architectures: A Dependence-based Approach" (Morgan Kaufmann, 2001) | Comprehensive textbook on loop optimization |
| Feautrier, "Dataflow Analysis of Array and Scalar References" (IJPP 1991) | Polyhedral model foundations |
Tradeoffs and Limitations
Approach Tradeoffs
| Approach | Pros | Cons |
| Unrolling | Reduces overhead | Code bloat |
| Tiling | Cache friendly | Complex bounds |
| Vectorization | SIMD speedup | Alignment requirements |
When NOT to Use This Skill
- Non-critical loops
- When code size matters more than speed
- When loops have complex control flow
Limitations
- Requires dependency analysis
- May increase code size
- Hardware-specific tuning needed
Assessment Criteria
A high-quality implementation should have:
| Criterion | What to Look For |
| Correctness | Preserves loop semantics |
| Performance | Measurable speedup |
| Generality | Handles various loop patterns |
| Safety | Checks for dependencies |
Quality Indicators
✅ Good: Correct transformation, significant speedup, handles dependencies ⚠️ Warning: Works for simple cases, fails on complex dependencies ❌ Bad: Breaks semantics, incorrect loop bounds
Research Tools & Artifacts
Real-world loop optimization tools:
| Tool | Why It Matters |
| LLVM loop passes | Production loop opts |
| GCC tree-ssa | GCC loop optimization |
| Polly (LLVM) | Polyhedral optimization |
| ISL | Integer set library |
Key Systems
- Polly: Polyhedral optimization
- Halide: Loop optimization DSL
Research Frontiers
Current loop optimization research:
| Direction | Key Papers | Challenge |
| Polyhedral | "Polyhedral Model" | Scalability |
| Auto-tuning | "Auto-tuning Loops" | Search |
| SIMD | "Auto-vectorization" | Vector width |
Hot Topics
- ML for loops: Learning loop transforms
- Quantum loops: Loop optimization for quantum
Implementation Pitfalls
Common loop optimization bugs:
| Pitfall | Real Example | Prevention |
| Dependencies | Wrong dependence | Analysis |
| Overflow | Loop bounds overflow | Careful math |
| Alignment | Vector alignment | Pad arrays |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

