Tomer Aberbach released profiler-md, a beta utility that transforms performance profiles into human-readable and LLM-friendly Markdown format. The tool supports dozens of profiling formats and origins, auto-detects input types, and produces structured output suitable for documentation, analysis, or agent-assisted optimization workflows.

Profile format coverage

profiler-md handles a wide spectrum of CPU profile formats, including callgrind, collapsed, ghc-eventlog, ghc-json-profile, hprof, jfr, jsc-heap-snapshot, memray, perf, pprof, speedscope, systing, trace-event, v8-cpu-profile, v8-heap-profile, v8-heap-snapshot, and webkit-timeline-recording. It also supports numerous profiling origins such as async-profiler, bun, chrome, clang, deno, dotnet-trace, eflambe, excimer, ghc, go, gperftools, jdk, memray, nix, node, node-pprof, perf, pprof-jl, pprof-rs, profile-jl, py-spy, pyinstrument, rbspy, safari, simpleperf, systing, tachyon, tsc, unknown, and valgrind. This breadth allows teams to convert profiles gathered from diverse runtimes and toolchains without custom conversion scripts.

Heap snapshot and trace event support

Beyond CPU profiles, the tool processes heap snapshots across categories like object, array, string, concatenated-string, sliced-string, function, code, regexp, number, big-number, symbol, native, object-shape, internal, synthetic, and unknown. Trace event categories covered include script, parsing, compilation, garbage-collection-pause, garbage-collection, style, layout, paint, io, and other. These capabilities extend profiler-md’s utility to memory analysis and runtime behavior investigation.

Function and category classification

Profiles are categorized into function groups such as ours, third-party, stdlib, native, unknown, garbage-collector, compiler, jit, regexp, kernel, and idle. Heap snapshots receive similar categorization with object, array, string, function, code, regexp, number, big-number, symbol, native, object-shape, internal, synthetic, and unknown. Trace events follow script, parsing, compilation, garbage-collection-pause, garbage-collection, style, layout, paint, io, and other categories. This classification structure lets users filter or highlight specific code domains within large profiles.

Command-line usage

The project provides a command-line interface installed globally via npm or Homebrew. Basic invocations convert a single profile file:

$ profiler-md profile.cpuprofile

It can also diff two profiles or heap snapshots to highlight regressions or improvements:

$ profiler-md base.cpuprofile current.cpuprofile

Output can be written to a file using the -o flag:

$ profiler-md profile.pb.gz -o profile.md

CLI options include --top-n to limit entries per ranking, --min-category-share to control subsection visibility, and filter flags such as --category, --hide, --show, and their -category counterparts. Diffing supports --match-name and --match-location to rewrite function names or paths when pairing entries across profiles.

API and programmatic access

profiler-md exposes a fully-typed API with both sync and async variants. Key functions include profileToMdAsync and diffProfilesAsync, which accept file paths or blob inputs and auto-detect format and origin. The API supports explicit format and origin specification, source map application, base URL resolution, and configuration callbacks for advanced workflows. A skill named profile-optimize guides AI agents through profiling and optimization cycles, invoking the CLI internally. The skill can be installed through package managers or integrated directly with Claude Code, Codex, and other agent platforms.

Example output and profile analysis

A demonstration profile collected from a TypeScript type-checking workload shows 2.52 seconds over 2,563 samples, averaging 982.2 microseconds per sample. Category breakdowns reveal third-party code consuming 86.1 percent of time, garbage collector at 7.5 percent, standard library at 4.8 percent, native code at 1.5 percent, regular expressions at 0.1 percent, and the tool’s own instrumentation at under 0.1 percent. The call tree traces through type-checking functions, ultimately landing in TypeScript’s internal checkSourceFileWorker and related routines. Hottest functions by self time include the garbage collector, wrapSafe, recursiveTypeRelatedTo, instantiateTypeWorker, checkTypeRelatedTo, isRelatedTo, and getObjectTypeInstantiation. These details illustrate how profiler-md surfaces the deepest call stacks and self-contained time expenditures within a profiling session.

Configuration and filtering

Users can customize output through a rich set of flags. Source maps can be applied via --source-maps with JSON or inline mappings. A --base-url rewrites paths relative to a project root or inferred from code. Ranking controls include --top-n and --min-category-share. Filtering rules use regular expressions to include or exclude entries, categories, or locations. These options let teams tailor profiles for readability, focused analysis, or integration with downstream tools.

Availability and integration

profiler-md is distributed as open-source software under the GitHub repository TomerAberbach/profiler-md. Installation options include npm i -g profiler-md, brew install tomeraberbach/tap/profiler-md, and shell completions for bash, fish, zsh, and PowerShell. The project documents 138 examples spanning C/C++, C#, F#, Elixir/Erlang, Fortran, Go, Haskell, Java/Kotlin/Groovy, JavaScript/TypeScript, Julia, Nix, PHP, Python, Ruby, Rust, Swift, and Zig. Each example links to base and current profile Markdown and their diff, enabling comparative studies or template-driven workflows. An AI agent skill, installable via npx skills add TomerAberbach/profiler-md --skill profile-optimize or through marketplace plugins, lowers the barrier for automated code optimization tasks.