一键导入
haskell-perf
Improve performance of Haskell code. Use when asked to profile or improve performance.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Improve performance of Haskell code. Use when asked to profile or improve performance.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Guides for Haskell code. Use when writing Haskell code.
Replace lens with microlens-* in Haskell packages
Security audit checklist for Rust code. Use when auditing Rust code for security vulnerabilities.
Re-generate Cabal freeze files.
Reviews Haskell comments for Haddock markup opportunities. Use when reviewing or improving Haskell documentation comments.
Remove extraneous comments. Use when the user requests removing comments.
| name | haskell-perf |
| description | Improve performance of Haskell code. Use when asked to profile or improve performance. |
Purpose:
Enable profiling in cabal.project.local:
profiling: True
profiling-detail: late
package *
profiling: True
ghc-options: -fprof-late
Then rebuild:
cabal build pkg:<executable>
This takes a long time (30+ minutes) for a fresh build with profiling. Run in background.
Profile a specific test case:
# Profile with RTS stats, perf counters, heap profile, cost centers
.agents/skills/perf/scripts/profile.py <executable> <args>
# Include valgrind instruction counting if perf is not working/available
.agents/skills/perf/scripts/profile.py --with-valgrind <executable> <args>
# Output: profile-results-<timestamp>/ directory with:
# - <binary>.prof (cost center report)
# - <binary>.hp (heap profile with parsed statistics)
# - perf-stats.log (CPU performance counters: instructions, cycles, IPC, cache misses, branch misses)
# - Summary printed to stdout
While quick fixes line pragmas (INLINE, SPECIALIZE) or strictness
annotations can be helpful, it is often most impactful to make changes to the
overall algorithm or structure of the computation. Instead of just looking
locally at the cost centers, think broadly about the context. Why is this
function a hot spot? What could be done to restructure the computation more
broadly? Don't be afraid to make big changes.
For each improvement identified, follow these steps:
profile.pyperf branch on that submodule before making changesprofiile.py and compare the metricsCRUCIAL!
You MUST collect before/after measurements using profile.py for each change.
Make only one change at a time.
Wall clock time is noisy, it's not even worth measuring. DO NOT USE wall-clock time.