prof

module
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2025 License: MIT

README ΒΆ

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 Issues Last Commit Code Size Version Go Version

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

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.

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.

Directories ΒΆ

Path Synopsis
cmd
prof command
engine

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL