# dgryski/go-perfbook

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/dgryski-go-perfbook).**

10,902 stars · 600 forks

## Links

- GitHub: https://github.com/dgryski/go-perfbook
- awesome-repositories: https://awesome-repositories.com/repository/dgryski-go-perfbook.md

## Topics

`optimization` `performance` `performance-analysis` `performance-optimization`

## Description

This project is a collection of educational resources and technical guides focused on Go performance optimization. It provides instruction on improving execution speed and reducing memory usage through code and architectural refinements.

The guides cover advanced strategies for low-level programming, including the use of assembly for SIMD instructions and unsafe pointers for direct memory manipulation. It also details concurrency optimization techniques such as lock sharding and cache-line padding to reduce contention and improve hardware utilization.

The material encompasses broad capability areas including memory management to reduce garbage collection pressure, runtime execution optimization to minimize interface overhead, and the use of profiling and benchmarking to identify system bottlenecks. It also addresses algorithmic efficiency and the reduction of overhead when integrating with C libraries.

## Tags

### Programming Languages & Runtimes

- [Go Performance Optimization](https://awesome-repositories.com/f/programming-languages-runtimes/go-performance-optimization.md) — A comprehensive guide for improving execution speed and resource efficiency in Go applications.
- [Cache Locality Optimizations](https://awesome-repositories.com/f/programming-languages-runtimes/cache-locality-optimizations.md) — Guides the alignment of data structures with CPU cache lines to reduce pointer chasing and maximize throughput. ([source](https://github.com/dgryski/go-perfbook/blob/master/performance-zh.md))
- [Execution Optimizations](https://awesome-repositories.com/f/programming-languages-runtimes/execution-optimizations.md) — Implements runtime execution optimizations such as reducing interface call overhead and eliminating bounds checks. ([source](https://github.com/dgryski/go-perfbook/blob/master/performance-ptbr.md))
- [Go Memory Optimization](https://awesome-repositories.com/f/programming-languages-runtimes/memory-allocation-optimizations/go-memory-optimization.md) — Guides the reduction of garbage collection pressure through optimized allocations and struct layouts in Go.
- [Go-C Bridges](https://awesome-repositories.com/f/programming-languages-runtimes/c-based-embedding-apis/go-c-bridges.md) — Provides guidance on minimizing transitions between Go and C to reduce Cgo call overhead. ([source](https://github.com/dgryski/go-perfbook/blob/master/performance-zh.md))
- [Method Call Specialization](https://awesome-repositories.com/f/programming-languages-runtimes/direct-method-call-generation/method-call-specialization.md) — Explains how to specialize method calls to reduce the overhead of virtual interface dispatch.
- [Concurrency Optimization](https://awesome-repositories.com/f/programming-languages-runtimes/go-performance-optimization/concurrency-optimization.md) — Guides the use of mutex sharding and cache line padding to reduce lock contention.
- [High-Concurrency Runtimes](https://awesome-repositories.com/f/programming-languages-runtimes/high-concurrency-runtimes.md) — Provides architectural patterns for scaling Go services through reduced lock contention and CPU cache locality.
- [Performance Optimization Libraries](https://awesome-repositories.com/f/programming-languages-runtimes/performance-optimization-libraries.md) — Recommends specialized high-performance libraries as alternatives to standard library packages for JSON and HTTP. ([source](https://github.com/dgryski/go-perfbook/blob/master/performance-zh.md))

### Part of an Awesome List

- [SIMD Implementations](https://awesome-repositories.com/f/awesome-lists/devtools/assemblers/simd-implementations.md) — Guides the implementation of critical paths using manual assembly and SIMD instructions to bypass compiler limits.
- [Profiling and Benchmarking](https://awesome-repositories.com/f/awesome-lists/devtools/profiling-and-benchmarking.md) — Provides methods for identifying bottlenecks using CPU/memory profiling and flame graphs.
- [Performance Optimization](https://awesome-repositories.com/f/awesome-lists/devtools/performance-optimization.md) — Detailed guide to writing high-performance Go code.

### Operating Systems & Systems Programming

- [High-Level Language Assembly Integration](https://awesome-repositories.com/f/operating-systems-systems-programming/high-level-language-assembly-integration.md) — Provides instructions for implementing critical paths in assembly to utilize SIMD instructions and hardware capabilities. ([source](https://github.com/dgryski/go-perfbook/blob/master/performance.md))
- [Context Reuse Strategies](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/memory-management/allocation-strategies/dynamic-memory-allocation/custom-memory-allocators/context-reuse-strategies.md) — Provides strategies for reusing buffers and state structures to minimize allocation overhead and garbage collection pressure.
- [Low-Level Systems Programming](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/memory-management/allocation-strategies/memory-allocation-libraries/low-level-system-operations/low-level-systems-programming.md) — Covers the implementation of critical paths using assembly and unsafe memory operations for maximum throughput.
- [Contention-Minimizing Locking Strategies](https://awesome-repositories.com/f/operating-systems-systems-programming/mutexes-and-locks/contention-minimizing-locking-strategies.md) — Describes strategies to reduce lock contention using mutex sharding and padding to prevent false sharing. ([source](https://github.com/dgryski/go-perfbook/blob/master/performance-ptbr.md))

### Software Engineering & Architecture

- [Pointer-Free Allocations](https://awesome-repositories.com/f/software-engineering-architecture/block-based-data-models/data-block-memory-management/contiguous-memory-buffers/manual-pointer-management/pointer-free-allocations.md) — Details the use of pointer-free memory allocations to allow the garbage collector to bypass object scanning.
- [Algorithmic Performance Optimizations](https://awesome-repositories.com/f/software-engineering-architecture/development-methodologies/performance-optimization-principles/algorithmic-performance-optimizations.md) — Offers techniques for analyzing and improving the time and space complexity of algorithms to prevent degradation. ([source](https://github.com/dgryski/go-perfbook/blob/master/performance.md))
- [Data Structure Optimizations](https://awesome-repositories.com/f/software-engineering-architecture/development-methodologies/performance-optimization-principles/algorithmic-performance-optimizations/data-structure-optimizations.md) — Demonstrates how to improve performance by adding redundant fields, search indices, or caches to data structures. ([source](https://github.com/dgryski/go-perfbook/blob/master/performance-es.md))
- [Memory Manipulation](https://awesome-repositories.com/f/software-engineering-architecture/integer-arithmetic/pointer-arithmetic/memory-manipulation.md) — Instruction on using unsafe pointers for direct memory access and high-speed deserialization.
- [Lock-Striped Sharding](https://awesome-repositories.com/f/software-engineering-architecture/producer-consumer-workflow-managers/lock-free-concurrent-queues/locking-optimizations/lock-striped-sharding.md) — Demonstrates lock-striped sharding to fragment global locks and reduce mutex contention in concurrent data structures.
- [Cache-Line Padding](https://awesome-repositories.com/f/software-engineering-architecture/shared-memory-management/memory-access-profilers/cache-aware-memory-access/simd-buffer-padding/cache-line-padding.md) — Implements cache-line padding to prevent false sharing and reduce CPU cache coherence traffic.
- [Low-Level Hardware Optimization](https://awesome-repositories.com/f/software-engineering-architecture/performance-reliability/code-optimization/low-level-machine-code-optimizations/low-level-hardware-optimization.md) — Provides advanced strategies for using unsafe pointers and assembly to optimize hardware cache and SIMD usage.
- [Space-Time Trade-off Strategies](https://awesome-repositories.com/f/software-engineering-architecture/space-time-trade-off-strategies.md) — Explains how to balance memory and CPU usage by storing precalculated data or calculating on-the-fly. ([source](https://github.com/dgryski/go-perfbook/blob/master/performance-es.md))

### System Administration & Monitoring

- [General Resource Bottleneck Detection](https://awesome-repositories.com/f/system-administration-monitoring/gpu-resource-monitoring/general-resource-bottleneck-detection.md) — Implements techniques for identifying performance bottlenecks and resource shortages across CPU, memory, and storage. ([source](https://github.com/dgryski/go-perfbook/blob/master/performance-zh.md))
- [Application Performance Profiling](https://awesome-repositories.com/f/system-administration-monitoring/performance-monitoring-tools/application-performance-profiling.md) — Teaches how to identify execution bottlenecks and hot paths using CPU and memory profiling tools.
- [GC Pressure Reduction](https://awesome-repositories.com/f/system-administration-monitoring/performance-monitoring/garbage-collection-monitors/gc-pressure-reduction.md) — Provides strategies for reducing garbage collector pressure through buffer reuse and avoiding heap allocations. ([source](https://github.com/dgryski/go-perfbook/blob/master/performance-zh.md))
- [Application Runtime Profilers](https://awesome-repositories.com/f/system-administration-monitoring/monitoring-and-observability/observability-platforms/distributed-tracing-execution-analysis/execution-run-apis/server-execution-profilers/application-runtime-profilers.md) — Analyzes CPU and memory usage using sampling tools to identify hot paths and allocation bottlenecks. ([source](https://github.com/dgryski/go-perfbook/blob/master/performance.md))
- [Performance Benchmarkers](https://awesome-repositories.com/f/system-administration-monitoring/monitoring-and-observability/observability-platforms/metric-performance-monitors/performance-benchmarkers.md) — Creates reproducible performance measurements using representative workloads and statistical tests. ([source](https://github.com/dgryski/go-perfbook/blob/master/performance-es.md))

### Testing & Quality Assurance

- [Performance Analysis](https://awesome-repositories.com/f/testing-quality-assurance/performance-testing-analysis/performance-analysis.md) — Provides methods and tools for interpreting performance data to identify system bottlenecks and evaluate efficiency. ([source](https://github.com/dgryski/go-perfbook/blob/master/performance-ptbr.md))
- [Real-World Workload Benchmarking](https://awesome-repositories.com/f/testing-quality-assurance/real-world-workload-benchmarking.md) — Provides methods for benchmarking using data distributions that simulate real-world production traffic patterns.

### Data & Databases

- [Memory Footprint Optimizers](https://awesome-repositories.com/f/data-databases/memory-footprint-optimizers.md) — Offers techniques for lowering memory consumption by eliminating structure padding and using smaller data types. ([source](https://github.com/dgryski/go-perfbook/blob/master/performance-zh.md))

### Education & Learning Resources

- [Memory Management Guides](https://awesome-repositories.com/f/education-learning-resources/memory-management-guides.md) — Educational resources for minimizing garbage collection pressure via buffer reuse and pointer-free structures.
