golang-performance

Profile and benchmark Go applications using pprof and go test.

7|4|Updated Feb 26, 2026
One-click install
npx skills add https://github.com/MadAppGang/magus --skill golang-performance-madappgang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-performance
Source: https://github.com/MadAppGang/magus/tree/main/plugins/dev/skills/backend/golang-performance
Command: npx skills add https://github.com/MadAppGang/magus --skill golang-performance-madappgang

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps developers identify and resolve performance bottlenecks in Go applications, leading to faster execution, reduced resource consumption, and improved scalability.

Core Features & Use Cases

  • Profiling: Analyze CPU, memory, and goroutine usage with pprof.
  • Benchmarking: Measure code performance and compare optimizations using go test -bench.
  • Memory Optimization: Techniques for reducing allocations and improving memory efficiency.
  • GC Tuning: Adjust Garbage Collection behavior for different environments.
  • Use Case: You've noticed your Go API is responding slowly under load. Use this Skill to profile the application, pinpoint the functions consuming the most CPU or memory, and apply optimization techniques like pre-allocating slices or using strings.Builder.

Quick Start

Use the golang-performance skill to profile the CPU usage of your Go application for 30 seconds and save the output to cpu.prof.

Frequently Asked Questions about golang-performance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I profile CPU usage in a Go application?

You can profile Go application CPU usage by utilizing the pprof tool to analyze execution and pinpoint functions consuming the most resources. This Skill helps profile your app for a set duration and save diagnostic output to a file like cpu.prof.

What is the best way to reduce high allocation rates and memory leaks in Go?

Reducing high allocation rates and memory leaks in Go requires applying memory optimization techniques like pre-allocating slices or using strings.Builder. This Skill provides methods to minimize memory pressure and improve overall garbage collection efficiency.

How do I benchmark Go code to measure performance improvements?

Benchmarking Go code to measure performance improvements is done using the go test -bench command. This allows you to compare code performance before and after applying optimizations, ensuring your changes effectively reduce execution time and resource consumption.

Can I adjust garbage collection behavior in Go for different environments?

Yes, you can adjust garbage collection (GC) behavior in Go for different environments through GC tuning. This Skill provides techniques to modify GC parameters, helping you balance latency and throughput based on your specific application workload and resource constraints.

Why is my Go API responding slowly under load and how can I fix it?

A Go API responding slowly under load often suffers from CPU-bound tasks or inefficient memory management. You can fix it by profiling the application with pprof to identify bottlenecks and applying optimization techniques like pre-allocating slices to reduce resource consumption.