Skip to content

copyleftdev/profile-party

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Profile Party

Your Code is Pretty. Your CPU Doesn't Care.

Profile Party

A side-by-side comparison of linter-perfect code vs CPU-perfect code, profiled with pprof, benchmarked with real numbers. One million transactions, two architectures, one uncomfortable truth: 63% of the runtime was garbage collection. The code review said "looks good to me."

Quick Start

go build -o profile-party .
./profile-party

Full Profiling Suite

chmod +x profile.sh
./profile.sh

This generates CPU + heap profiles for both versions, runs benchmarks, and tells you how to explore with pprof.

The Numbers

Pretty Fast Factor
Time 107 ms 28 ms 3.8x
Memory 101.5 MB 3.6 MB 28x
Allocations 282 7 40x
GC CPU 63% 0% ---

Read the Article

The full tutorial lives at the GitHub Pages site:

https://copyleftdev.github.io/profile-party

Project Structure

pretty.go        # The linter's favorite — interfaces, pipelines, string types
fast.go          # The CPU's favorite — struct-of-arrays, integers, one pass
main.go          # Generates 1M records, runs both, prints the verdict
bench_test.go    # go test -bench with memory reporting
profile.sh       # One script to profile everything
article.md       # Article source (Markdown)
docs/            # GitHub Pages site

Setup GitHub Pages

  1. Push this repo to GitHub
  2. Go to Settings > Pages
  3. Source: Deploy from a branch
  4. Branch: main, folder: /docs
  5. Save — your site goes live in ~60 seconds

CI/CD

Every push to main:

  1. Build & Benchmark — compiles the Go code, runs the comparison, executes benchmarks
  2. Deploy — publishes docs/ to GitHub Pages via actions/deploy-pages

PRs get the build + benchmark gate without deploying.

License

MIT

About

Your Code is Pretty. Your CPU Doesn't Care. — A profiling tutorial that pits linter-perfect Go against CPU-perfect Go. 63% of the runtime was garbage collection. The code review said 'looks good to me.'

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors