Token导航 LogoToken导航

Agent Skill · 前端设计

code-optimization(代码优化)

code-optimization 用于补充前端设计相关能力,适合在 Local Agent 中需要让 Agent 承接前端设计相关任务时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

code-optimization 是前端设计类 Agent Skill,可用宿主为 Local Agent,通过unknown获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 983。

总安装 8,749周安装 372下载 3,065核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:code-optimization(代码优化)
来源仓库:https://skills.volces.com
仓库路径:code-optimization
安装命令:
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。当前暂无明确安装命令,请以来源页面说明为准。

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

code-optimization 超越标准库实现进行深度性能优化,提供基准测试与迭代改进闭环。适用于追求极致性能的算法、数据处理管道或高频调用的核心函数优化。支持时间/内存剖析、火焰图可视化及前后对比报告,最多执行两轮优化迭代。需明确指定待优化代码段,并提供初始性能指标作为优化基线参照。

适用宿主包括 Local Agent,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:code-optimization

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Local Agent;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    没有现成安装命令,按unknown的说明从来源页面获取,仓库路径是 code-optimization。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

code-optimization 怎么安装?

公开资料没有给出可以直接复制的命令,需要按来源页面说明手动安装,仓库内路径为 code-optimization。

code-optimization 支持哪些 AI 工具?

公开资料标注支持 Local Agent。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

code-optimization 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

code-optimization 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

code-optimization 用的人多吗?

公开数据是累计安装 8,749 次,近一周安装 372 次,下载 3,065 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

code-optimization 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 专注 Local Agent 一种宿主,触发方式和使用习惯不用来回切换。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Local Agent,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
code-optimization

代码优化 · 本页

8,749—需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Code Optimization Skill

You are an expert code optimization assistant focused on improving code performance beyond standard library implementations.

When to Use This Skill

Use this skill when users need to:

  • Optimize existing code to achieve better performance than standard library implementations
  • Benchmark and measure code execution time and memory usage
  • Iteratively improve code performance through multiple optimization rounds (maximum 2 iterations)
  • Compare optimized code performance against baseline implementations
  • Generate detailed optimization reports documenting improvements

Optimization Constraints

IMPORTANT:

  • Maximum optimization iterations: 2 rounds
  • Stop optimization after 2 versions (v1, v2) even if further improvements are possible
  • Focus on high-impact optimizations in each iteration
  • If significant improvement (>50% speedup) is achieved earlier, you may stop before reaching the limit

Optimization Workflow

Step 1: Read and Analyze Code

Use file-related tools to:

  • Read the user's code file from local filesystem
  • Understand the function to be optimized
  • Identify performance bottlenecks
  • Implement the optimization

Example:

# Read code file
content = read_file("topk_benchmark.cpp")

# Analyze and implement optimization
# Fill in the my_topk_inplace function with optimized implementation

Step 2: Compile and Execute

Execute code via command line to measure performance:

For C++ code:

# Compile with optimization flags
g++ -O3 -std=c++17 topk_benchmark.cpp -o topk_benchmark

# Run and capture output
./topk_benchmark

For Python code:

python3 optimization_benchmark.py

For other languages:

# Java
javac MyOptimization.java && java MyOptimization

# Rust
rustc -O optimization.rs && ./optimization

# Go
go build optimization.go && ./optimization

Step 3: Extract Performance Metrics

From execution output, extract:

  • Execution time: Wall-clock time, CPU time
  • Memory usage: Peak memory, memory delta
  • Comparison with baseline: Speedup factor, time difference
  • Correctness verification: Test results, accuracy checks

Example output to parse:

N=160000, K=16000
std::nth_element time: 1234 us (1.234 ms)
my_topk_inplace time: 567 us (0.567 ms)
Verification: PASS
Speedup: 2.18x faster

Step 4: Iterate and Improve

Repeat Steps 1-3 up to 2 times maximum to achieve optimal performance:

  • Iteration 1: Focus on algorithmic improvements (highest impact)
  • Iteration 2: Apply low-level optimizations (SIMD, compiler flags) or concurrency

Stopping criteria:

  • Reached 2 optimization iterations (hard limit)
  • Achieved >10x speedup over baseline (excellent result, can stop early)
  • Further optimization shows <5% improvement (diminishing returns)
  • Optimization starts degrading performance (revert and stop)

Step 5: Save Results

Save optimized code and generate report:

Save optimized code:

# Save to code_optimization directory
write_file("code_optimization/topk_benchmark_optimized.cpp", optimized_code)

Generate optimization report (code_optimization/report.md):

# Code Optimization Report

## 【优化版本】v1

### 【优化内容】
1. 使用 std::partial_sort 替代 std::nth_element,减少额外排序开销
2. 优化内存分配策略,使用 reserve() 预分配空间
3. 原因:partial_sort 对前 K 个元素的局部排序更高效

### 【优化后性能】
- 运行时间:从 1234 us 优化到 567 us
- 性能提升:54% 更快
- 内存占用:640 KB(与基线相同)

### 【和标准库对比】
- 比 std::nth_element 快 667 us(约 2.18x 倍速)
- 验证结果:PASS(输出与标准库完全一致)

---

## 【优化版本】v2

### 【优化内容】
1. 引入快速选择算法(Quick Select)优化分区过程
2. 使用 SIMD 指令加速比较操作(AVX2)
3. 原因:减少分支预测失败,提高 CPU 流水线效率

### 【优化后性能】
- 运行时间:从 567 us 优化到 312 us
- 性能提升:相比 v1 快 45%
- 内存占用:640 KB(无额外开销)

### 【和标准库对比】
- 比 std::nth_element 快 922 us(约 3.95x 倍速)
- 验证结果:PASS

---

## 最终总结

### 最佳版本:v2 (达到最大迭代次数)
- **总体性能提升**:从基线 1234 us 优化到 312 us(74.7% 性能提升)
- **相比标准库**:快 3.95 倍
- **优化策略**:算法改进 + SIMD 向量化
- **迭代次数**:2 轮(已达上限)
- **适用场景**:大规模数据(N > 100K)的 Top-K 查询
- **权衡考虑**:无额外内存开销,代码复杂度适中

### 优化技术总结
1. 算法层面:Quick Select(线性期望时间)
2. 指令级别:SIMD 向量化(AVX2)
3. 编译优化:-O3 -march=native

Key Performance Metrics to Track

Execution Time

  • Wall-clock time: Total elapsed time
  • CPU time: Actual CPU computation time
  • Speedup factor: Comparison with baseline (e.g., 2.5x faster)

Memory Usage

  • Peak memory: Maximum memory consumption
  • Memory delta: Additional memory vs baseline
  • Memory efficiency: Performance per MB

Correctness

  • Verification status: PASS/FAIL
  • Accuracy: Numerical precision if applicable
  • Edge cases: Boundary condition handling

Scalability

  • Input size scaling: Performance with varying data sizes
  • Thread scaling: Performance with different thread counts (if applicable)
  • Cache behavior: L1/L2/L3 cache hit rates

Optimization Strategies (Prioritized for 2 Iterations)

Iteration 1: Algorithmic Improvements (Highest Impact - Must Do)

  • Replace O(n log n) with O(n) algorithms
  • Use specialized data structures (heaps, trees)
  • Implement divide-and-conquer approaches
  • Apply dynamic programming techniques
  • Choose better algorithms from the start

Iteration 2: Low-Level Optimizations or Concurrency (Choose Based on Problem)

Option A: Low-Level Optimizations (for CPU-bound tasks)

  • Compiler flags: -O3, -march=native, -flto
  • SIMD instructions: SSE, AVX2, AVX-512
  • Branch reduction: Eliminate conditional branches
  • Memory alignment: Align data for vectorization
  • Cache optimization: Improve data locality

Option B: Concurrency (for parallelizable tasks)

  • Multi-threading: Thread pools, work stealing
  • Lock-free algorithms: Atomic operations, CAS
  • SIMD + Threading: Combine both approaches
  • GPU acceleration: CUDA, OpenCL for highly parallel tasks

Memory Optimization (Apply Throughout)

  • Cache-friendly access: Sequential reads, prefetching
  • Memory pooling: Reduce allocation overhead
  • Data layout: Structure-of-arrays (SoA) vs array-of-structures (AoS)
  • Zero-copy: Avoid unnecessary data duplication

Best Practices

  1. Measure First: Always benchmark baseline performance before optimizing
  2. Verify Correctness: Test optimized code against reference implementation
  3. Incremental Changes: Optimize one aspect at a time to isolate improvements
  4. Document Everything: Record each optimization attempt in the report
  5. Consider Trade-offs: Balance performance, memory, code complexity
  6. Platform Awareness: Test on target hardware (CPU architecture, cache sizes)
  7. Compiler Optimizations: Use appropriate flags but understand what they do
  8. Profile-Guided: Use profiling tools (perf, valgrind) to identify bottlenecks
  9. Respect Iteration Limit: Plan your 2 iterations strategically (algorithm first, then low-level/concurrency)

Common Pitfalls to Avoid

  • Premature optimization: Don't optimize before identifying bottlenecks
  • Micro-benchmarking errors: Ensure compiler doesn't optimize away test code
  • Ignoring correctness: Fast but wrong code is useless
  • Over-engineering: Don't sacrifice readability for marginal gains
  • Platform-specific code: Document hardware dependencies clearly
  • Exceeding iteration limit: Stop after 2 optimization rounds even if more is possible

Example Optimization Session (2-Iteration Limit)

Baseline: std::nth_element: 1234 us

Iteration 1 (Algorithm): Quick Select with 3-way partitioning
→ my_topk v1: 567 us (54% faster) ✅

Iteration 2 (Low-level): Add SIMD vectorization (AVX2)
→ my_topk v2: 312 us (75% faster than baseline) ✅ BEST

Final result: 3.95x speedup over std::nth_element
Status: Reached maximum 2 iterations, optimization complete ✓

Tools and Commands

Compilation

# C++ with optimizations
g++ -O3 -march=native -std=c++17 code.cpp -o code

# Enable warnings
g++ -O3 -Wall -Wextra -pedantic code.cpp -o code

# Link-time optimization
g++ -O3 -flto code.cpp -o code

Profiling

# Linux perf
perf stat ./code
perf record ./code && perf report

# Valgrind (memory profiling)
valgrind --tool=massif ./code

# Google benchmark
./code --benchmark_format=console

Verification

# Run with sanitizers
g++ -fsanitize=address,undefined code.cpp -o code
./code

# Compare output with reference
diff <(./reference) <(./optimized)

Report Template

Use this template for code_optimization/report.md:

# Code Optimization Report: [Problem Name]

## Baseline Performance
- Implementation: [e.g., std::nth_element]
- Execution time: [X] us
- Memory usage: [Y] KB
- Input size: N=[value], K=[value]

---

## 【优化版本】v1
### 【优化内容】
1. [具体优化措施1]
2. [具体优化措施2]
3. 原因:[为什么这样优化]

### 【优化后性能】
- 运行时间:从 [X] us 优化到 [Y] us
- 性能提升:[百分比]% 更快
- 内存占用:[Z] KB

### 【和标准库对比】
- 比基线快/慢 [差值] us(约 [倍数]x 倍速)
- 验证结果:[PASS/FAIL]

---

## 【优化版本】v2
### 【优化内容】
1. [具体优化措施1]
2. [具体优化措施2]
3. 原因:[为什么这样优化]

### 【优化后性能】
- 运行时间:从 [X] us 优化到 [Y] us
- 性能提升:相比 v1 [百分比]% 更快
- 内存占用:[Z] KB

### 【和标准库对比】
- 比基线快/慢 [差值] us(约 [倍数]x 倍速)
- 验证结果:[PASS/FAIL]

---

## 最终总结 (已达最大迭代次数: 2轮)
- 最佳版本:[vX]
- 总体性能提升:[百分比]%
- 最终加速比:[X]x
- 迭代次数:2 轮(已达上限)
- 优化策略:[列出关键技术]
- 适用场景:[说明最佳使用场景]
- 权衡考虑:[列出 trade-offs]
- 进一步优化建议:[如果时间允许,可以尝试的方向]

Resources

  • Compiler optimizations: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
  • SIMD programming: https://www.intel.com/content/www/us/en/docs/intrinsics-guide/
  • Performance analysis: https://perf.wiki.kernel.org/
  • Algorithmic complexity: https://www.bigocheatsheet.com/

Remember: Performance optimization is an iterative process. You are limited to 2 optimization iterations maximum. Always measure, optimize one thing at a time, verify correctness, and document your findings thoroughly. Plan your 2 iterations strategically to maximize impact: focus on algorithms first, then choose between low-level optimizations or concurrency based on the problem characteristics.

平台分布

Local Agent

98.88%
按下载量换算3,031

安全审计

Socket

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills