benchee-profiling
MANDATORY when profiling and benchmarking Elixir code, or before optimizing performance-critical code.
Skill by igmarin
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/igmarin-benchee-profiling
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: devops
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/benchee-profiling
What's inside
- Skill name
benchee-profiling- Description
- MANDATORY when profiling and benchmarking Elixir code, or before optimizing performance-critical code. Sets up Benchee benchmarks, measures execution time, compares function implementations, generates profiling reports with :fprof and :eprof, and integrates benchmark regression checks into CI pipelines. Trigger words: Benchee, benchmark, profiling, performance, optimization, speed, comparison, benchee.run, benchee.measure, fprof, eprof, profile, ips, runtime, memory_time, warmup, batch_size, inputs, regression, baseline, performance comparison.
- License
- MIT
- Metadata
- version: 1.0.0 · user-invocable: true
- Instructions
- 246 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Benchee Profiling
## RULES — Follow these with no exceptions
**1.** **Profile first** — run `:fprof` or `:eprof` and verify the output explicitly names the expected slow call site; re-run with a larger workload if ambiguous
**2.** **Write a comparative benchmark** — implement at least 2 alternative approaches using Benchee, ensuring implementations do the same thing; benchmark in `MIX_ENV=prod` for realistic results
**3.** **Use multiple inputs** — test with small, medium, and large realistic data sizes to catch size-dependent behavior
**4.** **Warm up before measuring** — use `warmup: 2` and `time: 10`; repeat 3–5 times to rule out variance; if results are within noise (< 5% difference), run 3 additional times
**5.** **Validate improvement** — confirm the faster approach wins across all input sizes
**6.** **Save baseline and check regressions** — write results to `bench/baseline.json`; raise an error if performance degrades more than 10% (compare against the previous 3 baselines before raising to rule out noise)
**7.** **Separate I/O benchmarks** — never benchmark network or disk I/O in the same run as compute benchmarks
## Setup
```elixir
# mix.exs
defp deps do
[
{:benchee, "~> 1.3", only: :dev}
]
end
```
## Basic Benchmark with Full Configuration
Use this pattern as the starting point for any new benchmark — it covers timing, memory, multiple inputs, and formatted output in one call.
```elixir
# bench/list_benchmark.exs
Benchee.run(
%{
"Enum.sort" => fn list -> Enum.sort(list) end,
"Enum.sort_by" => fn list -> Enum.sort_by(list, & &1) end
},
time: 10, # Run each scenario for 10 seconds
warmup: 2, # Warm up for 2 seconds
memory_time: 2, # Measure memory usage
reduction_time: 2, # Measure reductions
inputs: %{
"small list" => Enum.to_list(1..100),
"medium list" => Enum.to_list(1..10_000),
"large list" => Enum.to_list(1..100_000)
},
formatters: [
{Benchee.Formatters.Console, comparison: true},
{Benchee.Formatters.HTML, file: "output/benchmark.html"}
]
)
```
```bash
# Run benchmark
MIX_ENV=prod mix run bench/list_benchmark.exs
```
## Comparing Real-World Implementations
Use this pattern when you have multiple concrete implementations of the same operation and need to confirm which is fastest across realistic data. Unlike the basic example above, this section demonstrates benchmarking non-trivial logic defined in a module.
```elixir
defmodule StringOperations do
def concat_loop(strings) do
Enum.reduce(strings, "", fn s, acc -> acc <> s end)
end
def concat_join(strings) do
Enum.join(strings)
end
def concat_comprehension(strings) do
for s <- strings, into: "", do: s
end
end
strings = for i <- 1..1000, do: "string_#{i}"
Benchee.run(%{
"reduce" => fn -> StringOperations.concat_loop(strings) end,
"join" => fn -> StringOperations.concat_join(strings) end,
"comprehension" => fn -> StringOperations.concat_comprehension(strings) end
})
```
## Profiling with :fprof
```elixir
:fprof.trace(:start, file: 'trace.trace')
MyApp.SlowFunction.run()
:fprof.trace(:stop)
:fprof.profile(file: 'trace.trace')
:fprof.analyse(dest: 'analysis.txt')
```
## Profiling with :eprof
```elixir
:eprof.start()
:eprof.start_profiling([self()])
MyApp.SlowFunction.run()
:eprof.stop_profiling()
:eprof.analyze()
:eprof.stop()
```
## Benchmark Suite Organization
```
bench/From igmarin/elixir-phoenix-skills, MIT.
More from igmarin/elixir-phoenix-skills
- 0.585score
phoenix-authorization-patterns
igmarin
Handles all authorization and access control work in Phoenix and LiveView applications.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
ash-framework
igmarin
MANDATORY when considering, adopting, or working with Ash Framework for Elixir applications.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
broadway-data-pipelines
igmarin
MANDATORY when building data processing pipelines or consuming message queues.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
oban-essentials
igmarin
MANDATORY for ALL Oban work.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
cachex-caching
igmarin
MANDATORY for implementing caching in Elixir applications.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
otp-essentials
igmarin
MANDATORY for ALL OTP work.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
phoenix-authentication
igmarin
Use when adding or changing Phoenix authentication, phx.gen.auth integration, LiveView session identity, or migration between current_user and Phoenix 1.8…
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
apply-phoenix-controller-conventions
igmarin
Use when writing new controller code in Phoenix applications.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
deployment-gotchas
igmarin
MANDATORY for deployment and release configuration.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
ecto-changeset-patterns
igmarin
MANDATORY for ALL changeset work beyond basic CRUD.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
ecto-nested-associations
igmarin
MANDATORY for ALL nested association and multi-table work.
SkillAFreshness: A★ 5Claude Code +9 - 0.585score
gettext-i18n
igmarin
Use when implementing internationalization (i18n) in Elixir/Phoenix applications.
SkillAFreshness: A★ 5Claude Code +9
Signals
- Stars
- 5
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Sep 28, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 1.0.0
- License
- MIT
- Repository
- github.com/igmarin/elixir-phoenix-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from igmarin
- 0.619score
implement-hotwire
igmarin
Use when adding Turbo Frames, Turbo Streams, or Stimulus controllers.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
optimize-performance
igmarin
Use when investigating N+1s, slow queries, caching, or query plans in Rails.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
extract-engine
igmarin
Use when extracting a host-app feature into a Rails engine.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
implement-authorization
igmarin
Use when adding or reviewing Rails authorization with Pundit, CanCanCan, or policy objects.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
create-engine
igmarin
Use when scaffolding a new Rails engine.
SkillAFreshness: A★ 28Claude Code +9 - 0.619score
seed-database
igmarin
Use when choosing seeds, fixtures, or factories for Rails dev/test data.
SkillAFreshness: A★ 28Claude Code +9
Cite this page
benchee-profiling skill. Agent Mart. https://agentmart.dev/skills/igmarin-benchee-profiling (last updated 2026-10-24)