{"id":20199329,"url":"https://github.com/mwiater/golangpprof","last_synced_at":"2026-05-23T16:40:39.817Z","repository":{"id":197491120,"uuid":"698736399","full_name":"mwiater/golangpprof","owner":"mwiater","description":"Dive into Go's pprof tool, unveiling its capabilities through practical examples and showcasing how it can transform your code optimization journey.","archived":false,"fork":false,"pushed_at":"2023-10-02T18:05:10.000Z","size":5472,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-13T19:52:08.579Z","etag":null,"topics":["golang","goroutines","optimization","pprof"],"latest_commit_sha":null,"homepage":"https://medium.com/@matt.wiater/pprof-through-examples-demystifying-gos-profile-guided-optimization-444fa08cf15f","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mwiater.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-30T20:01:04.000Z","updated_at":"2023-10-07T18:14:43.000Z","dependencies_parsed_at":"2024-06-21T17:55:39.388Z","dependency_job_id":"9d5266d6-42a2-4121-ab8c-ae76f7719077","html_url":"https://github.com/mwiater/golangpprof","commit_stats":null,"previous_names":["mwiater/golangpgo","mwiater/golangpprof"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mwiater%2Fgolangpprof","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mwiater%2Fgolangpprof/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mwiater%2Fgolangpprof/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mwiater%2Fgolangpprof/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mwiater","download_url":"https://codeload.github.com/mwiater/golangpprof/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241637149,"owners_count":19994925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","goroutines","optimization","pprof"],"created_at":"2024-11-14T04:37:07.867Z","updated_at":"2026-05-23T16:40:34.781Z","avatar_url":"https://github.com/mwiater.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# golangpprof\n\n**Source code and examples for the article: [Pprof Through Examples: Exploring Optimizations in Go](https://medium.com/@matt.wiater/pprof-through-examples-exploring-optimizations-in-go-444fa08cf15f)**\n\n**Table of Contents**\n\n* [Setup](#setup)\n* [Build binaries](#build-binaries)\n* [Run binaries](#run-binaries)\n* [Tests](#tests)\n* [Pprof Examples](#pprof-examples)\n\n---\n\n## Setup\n\n```\ngit clone https://github.com/mwiater/golangpprof\ncd golangpprof\ngo mod tidy\n```\n\n---\n\n## Build binaries\n\nFirst, build all of the binaries for a more direct, consistent run:\n\n```\ngo build -o ./bin imageprocessing.go\ngo build -o ./bin steps/step01.go\ngo build -o ./bin steps/step02.go\ngo build -o ./bin steps/step03.go\ngo build -o ./bin steps/step04.go\n```\n\n---\n\n## Run binaries\n\n### imageprocessing\n\n`./bin/imageprocessing`\n\nRuns: ProcessImageGrayscale\nOutputs: `./pprof/cpu-ProcessImageGrayscale.pprof`\nRuns: ProcessImageGrayscale\nOutputs: `./pprof/cpu-ProcessImageGrayscale.pprof`\nRuns: ProcessImageSharpen\nOutputs: `./pprof/cpu-ProcessImageSharpen.pprof`\nRuns: ProcessImageSharpenOptimized\nOutputs: `./pprof/cpu-ProcessImageSharpenOptimized.pprof`\n\nExample command output:\n\n```\nFunction                         |File Size       |Execution Time   |Performance Gain   |Concurrency\nProcessImageGrayscale            |5598865 Bytes   |772ms            |(baseline)         |1\nProcessImageGrayscaleOptimized   |5598865 Bytes   |520ms            |1.48x              |8\nProcessImageSharpen              |5598865 Bytes   |2590ms           |(baseline)         |1\nProcessImageSharpenOptimized     |5598865 Bytes   |838ms            |3.09x              |8\n\nMax Baseline Throughput Per Day (GB):  268.01\nMax Optimized Throughput Per Day (GB): 663.50\n```\n\n### step01\n\n`./bin/step01`\n\nRuns: ProcessImageGrayscale\n\nExample command output:\n\n```\nSuccess\n```\n\n### step02\n\n`./bin/step02`\n\nRuns: ProcessImageGrayscale\nOutputs: `./pprof/cpu-ProcessImageGrayscale.pprof`\n\nExample command output:\n\n```\nFunction                         |File Size       |Execution Time   |Performance Gain   |Concurrency\nProcessImageGrayscale            |5598865 Bytes   |772ms            |(baseline)         |1\n```\n\n### step03\n\n`./bin/step03`\n\nRuns: ProcessImageGrayscale\nOutputs: `./pprof/cpu-ProcessImageGrayscale.pprof`\nRuns: ProcessImageGrayscale\nOutputs: `./pprof/cpu-ProcessImageGrayscale.pprof`\n\nExample command output:\n\n```\nFunction                         |File Size       |Execution Time   |Performance Gain   |Concurrency\nProcessImageGrayscale            |5598865 Bytes   |772ms            |(baseline)         |1\nProcessImageGrayscaleOptimized   |5598865 Bytes   |520ms            |1.48x              |8\n```\n\n### step04\n\n`./bin/step04`\n\nRuns: ProcessImageGrayscale\nOutputs: `./pprof/cpu-ProcessImageGrayscale.pprof`\nRuns: ProcessImageGrayscale\nOutputs: `./pprof/cpu-ProcessImageGrayscale.pprof`\nRuns: ProcessImageSharpen\nOutputs: `./pprof/cpu-ProcessImageSharpen.pprof`\nRuns: ProcessImageSharpenOptimized\nOutputs: `./pprof/cpu-ProcessImageSharpenOptimized.pprof`\n\nExample command output:\n\n```\nFunction                         |File Size       |Execution Time   |Performance Gain   |Concurrency\nProcessImageGrayscale            |5598865 Bytes   |772ms            |(baseline)         |1\nProcessImageGrayscaleOptimized   |5598865 Bytes   |520ms            |1.48x              |8\nProcessImageSharpen              |5598865 Bytes   |2590ms           |(baseline)         |1\nProcessImageSharpenOptimized     |5598865 Bytes   |838ms            |3.09x              |8\n\nMax Baseline Throughput Per Day (GB):  268.01\nMax Optimized Throughput Per Day (GB): 663.50\n```\n\n---\n\n## Tests\n\n`go install gotest.tools/gotestsum@latest`\n\n`go clean -testcache \u0026\u0026 gotestsum -f testname ./imageprocessing ./common`\n\n```\nPASS common.TestGetFunctionName (0.00s)\nPASS common.TestPrintResults (0.00s)\nPASS common\nPASS imageprocessing.TestProcessImageSharpen_Decode (0.30s)\nPASS imageprocessing.TestProcessImageSharpen_Processing (2.59s)\nPASS imageprocessing.TestProcessImageSharpen_OutputSize (0.00s)\nPASS imageprocessing.TestProcessImageSharpen_DifferentFromInput (0.89s)\nPASS imageprocessing.TestProcessImageSharpenOptimized_Decode (0.30s)\nPASS imageprocessing.TestProcessImageSharpenOptimized_Processing (0.90s)\nPASS imageprocessing.TestProcessImageSharpenOptimized_OutputSize (0.00s)\nPASS imageprocessing.TestProcessImageSharpenOptimized_DifferentFromInput (0.92s)\nPASS imageprocessing.TestProcessImageGrayscale_Decode (0.78s)\nPASS imageprocessing.TestProcessImageGrayscale_OutputSize (0.00s)\nPASS imageprocessing.TestProcessImageGrayscale_GrayscaleOutput (0.19s)\nPASS imageprocessing.TestProcessImageGrayscaleOptimized_Decode (0.51s)\nPASS imageprocessing.TestProcessImageGrayscaleOptimized_OutputSize (0.00s)\nPASS imageprocessing.TestProcessImageGrayscaleOptimized_GrayscaleOutput (0.19s)\nPASS imageprocessing\n\nDONE 16 tests in 7.836s\n```\n\n---\n\n## Pprof Examples\n\nFiles included:\n\n```\n./pprof-examples/\n  pprof-examples/cpu-ProcessImageGrayscale.pprof\n  pprof-examples/cpu-ProcessImageGrayscaleOptimized.pprof\n  pprof-examples/cpu-ProcessImageSharpen.pprof\n  pprof-examples/cpu-ProcessImageSharpenOptimized.pprof\n  pprof-examples/PPROF-EXAMPLES.MD\n```\n\nSince running the application generates slightly different results each time based on your systems current resource usage at the time of running, I've included example pprof files from my machine during a single run. This way our comparisons are not altered by variations that may be introduced during multiple runs. Variations like this are expected, but when illustrating with examples, eliminating these variations makes comparisons clearer.\n\n**These are the files and output referenced in the article: [Pprof Through Examples: Exploring Optimizations in Go](https://medium.com/@matt.wiater/pprof-through-examples-exploring-optimizations-in-go-444fa08cf15f)**\n\nSee [pprof-examples/PPROF-EXAMPLES.MD](pprof-examples/PPROF-EXAMPLES.MD) for full output results.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmwiater%2Fgolangpprof","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmwiater%2Fgolangpprof","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmwiater%2Fgolangpprof/lists"}