Skip to content

AlexsanderHamir/prof

Prof - Go Benchmark Profiling Made Simple

Prof automates Go performance profiling by collecting all pprof data in one command and enabling easy performance comparisons between benchmark runs.

GoDoc Go Report Card License: MIT Issues Last Commit Code Size Version Go Version

πŸ“– Documentation | ▢️ Watch Demo Video | ▢️ Watch TUI Demo

The project is actively looking for contributors !!

Why Prof?

Before Prof: Profiling a single benchmark with multiple profile types requires dozens of manual commands:

# Run benchmark
go test -bench=BenchmarkName -cpuprofile=cpu.out -memprofile=memory.out ...

# Generate reports for each profile type
go tool pprof -cum -top cpu.out
go tool pprof -cum -top memory.out

# Extract function-level data for each function of interest
go tool pprof -list=Function1 cpu.out > function1.txt
go tool pprof -list=Function2 cpu.out > function2.txt
# ... repeat for every function Γ— every profile type

With Prof: One command collects everything and organizes it automatically.

πŸš€ Supercharge Your Development Tools

When you use Prof with AI-powered development tools like Cursor, you get a massive productivity boost:

  • 80% faster completion - Prof provides structured, organized profiling data that AI tools can instantly analyze
  • Much better optimization suggestions - AI tools can see the complete performance picture across all profile types
  • Smarter code recommendations - With detailed function-level profiling data, AI tools can suggest more targeted optimizations
  • Faster debugging - AI tools can quickly identify performance bottlenecks using Prof's organized output format

Instead of AI tools struggling with raw pprof files, they get clean, structured data that enables them to provide superior performance insights and code improvements.

Key Features

πŸš€ One Command Profiling

Collect CPU, memory, mutex, and block profiles in a single command:

prof auto --benchmarks "BenchmarkName" --profiles "cpu,memory,mutex,block" --count 10 --tag "baseline"

πŸ“Š Performance Comparison

Easily compare performance between different versions or optimizations:

prof track auto --base "baseline" --current "optimized" --profile-type "cpu" --bench-name "BenchmarkName"

πŸ” Regression Detection

Fail CI/CD pipelines on performance regressions with configurable thresholds:

prof track auto --base "baseline" --current "PR" --profile-type "cpu" --bench-name "BenchmarkName" --fail-on-regression --regression-threshold 5.0

Enhanced CI/CD Support: Configure function filtering, and custom thresholds to reduce noise and make CI/CD more reliable. See CI/CD Configuration Guide for details.

πŸ“ Organized Output

All profiling data is automatically organized under bench/<tag>/ directories with clear structure.

πŸ“¦ Package-Level Grouping

Organize profile data by package/module for better analysis and collaboration:

# Group profile data by package when collecting
prof auto --benchmarks "BenchmarkName" --profiles "cpu,memory" --count 5 --tag "baseline" --group-by-package

# Group profile data from existing files
prof manual --tag "external-profiles" --group-by-package cpu.prof memory.prof

When enabled, this creates additional *_grouped.txt files that organize functions by their package/module, making it easier to:

  • Identify which packages consume the most resources
  • Share package-level performance insights with team members
  • Focus optimization efforts on specific modules

Interactive TUI

Don't want to remember benchmark names or commands? Use the interactive terminal interface:

prof tui

What it does:

  • πŸ” Auto-discovers all BenchmarkXxx functions in your project
  • πŸ“‹ Interactive selection of benchmarks, profiles, count, and tag
  • 🎯 No typos - everything is selected from menus
  • πŸ“ Same output as prof auto - organized under bench/<tag>/

TUI Track Mode: Compare existing benchmark data interactively:

prof tui track

Installation

go install github.com/AlexsanderHamir/prof/cmd/prof@latest

Quick Start

  1. Collect profiling data:
prof auto --benchmarks "BenchmarkName" --profiles "cpu,memory,mutex,block" --count 10 --tag "baseline"
prof auto --benchmarks "BenchmarkName" --profiles "cpu,memory,mutex,block" --count 10 --tag "optimized"
  1. Compare performance:
prof track auto --base "baseline" --current "optimized" --profile-type "cpu" --bench-name "BenchmarkName" --output-format "summary"

Documentation

Requirements

  • Go 1.24.3 or later
  • Install graphviz
  • A Go module (go.mod) at the repository root

License

This project is licensed under the MIT License - see the LICENSE file for details.

Packages

No packages published

Languages