بنقرة واحدة
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 المهني
| 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.
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.