• Stars
    star
    577
  • Rank 77,363 (Top 2 %)
  • Language
    Go
  • License
    BSD 3-Clause "New...
  • Created over 4 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Shotizam analyzes the size of Go binaries

Shotizam

Shotizam analyzes the size of Go binaries and outputs SQL with size info for analysis in SQLite3.

$ shotizam --sqlite /some/go.binary
SQLite version 3.28.0 2019-04-15 14:49:49
Enter ".help" for usage hints.
sqlite> .width 40
sqlite> .mode column

sqlite> select func, sum(size) from bin where func <> '' group by 1 order by 2 desc limit 20;
unicode.init                              21528
debug/dwarf.init                          13764
fmt.(*pp).printValue                      11941
debug/macho.NewFile                       10017
time.Time.AppendFormat                    9949
runtime.gentraceback                      8278
debug/elf.NewFile                         7631
runtime.selectgo                          6722
encoding/binary.Read                      6555
main.main                                 6476
internal/fmtsort.compare                  6373
time.LoadLocationFromTZData               5795
fmt.(*pp).doPrintf                        5520
runtime.findrunnable                      5287
runtime.typesEqual                        4843
time.nextStdChunk                         4736
time.ParseDuration                        4440
time.loadTzinfoFromZip                    4234
runtime.(*pageAlloc).find                 4109
runtime.heapBitsSetType                   3938

sqlite> select what, sum(size) from bin group by 1;
TODO                                      1370985
fixedheader                               101800
funcdata                                  99656
funcname                                  63062
pcdata0-regmap                            54361
pcdata1-stackmap                          47977
pcdata2-inltree                           40024
pcfile                                    38544
pcln                                      141103
pcsp                                      36478
text                                      896722

sqlite> select pkg, sum(size) from bin where pkg <> '' group by 1 order by 2 desc limit 20;
runtime               621236
reflect               187926
fmt                   61727
time                  58786
strconv               55817
syscall               39481
debug/elf             37070
os                    36707
compress/flate        31462
debug/macho           27117
encoding/binary       26637
os/exec               26599
internal/reflectlite  23687
unicode               22316
sync                  21322
flag                  20871
debug/dwarf           17692
internal/poll         17092
strings               15511
sort                  14992

sqlite> select func, length(func) from bin order by 2 desc limit 5;
type..eq.[67]struct { runtime.size uint3  89
type..eq.[67]struct { runtime.size uint3  89
type..eq.[67]struct { runtime.size uint3  89
type..eq.[67]struct { runtime.size uint3  89
type..eq.[67]struct { runtime.size uint3  89

sqlite> select func, sum(size) from bin where what = 'pcfile' and func <> '' group by 1 order by 2 desc limit 20;
internal/fmtsort.compare                  268
fmt.(*pp).printValue                      227
encoding/binary.Read                      195
os.Getwd                                  174
runtime.sighandler                        172
runtime.(*pageAlloc).scavengeOne          153
runtime.findrunnable                      148
debug/macho.NewFile                       131
runtime.selectgo                          130
syscall.forkAndExecInChild                129
main.main                                 123
runtime.(*mspan).sweep                    123
internal/fmtsort.nilCompare               119
runtime.growslice                         119
debug/elf.NewFile                         112
fmt.intFromArg                            107
runtime.greyobject                        105
runtime.evacuate_fast64                   103
runtime.mapaccess2_faststr                101
runtime.evacuate                          99

sqlite> select func, sum(size) from bin where what = 'pcln' and func <> '' group by 1 order by 2 desc limit 20;
time.Time.AppendFormat                    1347
runtime.gentraceback                      1132
runtime.selectgo                          1102
fmt.(*pp).printValue                      1027
runtime.findrunnable                      830
runtime.heapBitsSetType                   794
internal/fmtsort.compare                  720
runtime.memmove                           720
debug/macho.NewFile                       692
fmt.(*pp).doPrintf                        638
encoding/binary.Read                      616
runtime.runGCProg                         613
syscall.forkAndExecInChild                552
debug/elf.NewFile                         539
runtime.mallocgc                          532
time.LoadLocationFromTZData               530
runtime.duffcopy                          528
aeshashbody                               518
runtime.(*mspan).sweep                    502
runtime.sighandler                        478

sqlite> select * from bin limit 30;
go.buildid                                            fixedheader  40
go.buildid                                            text         112
go.buildid                                            funcname     11
internal/cpu.Initialize                   internal/c  fixedheader  40
internal/cpu.Initialize                   internal/c  pcsp         13
internal/cpu.Initialize                   internal/c  pcfile       5
internal/cpu.Initialize                   internal/c  pcln         21
internal/cpu.Initialize                   internal/c  pcdata0-reg  22
internal/cpu.Initialize                   internal/c  pcdata1-sta  21
internal/cpu.Initialize                   internal/c  text         80
internal/cpu.Initialize                   internal/c  funcname     24
internal/cpu.processOptions               internal/c  fixedheader  40
internal/cpu.processOptions               internal/c  pcsp         24
internal/cpu.processOptions               internal/c  pcfile       6
internal/cpu.processOptions               internal/c  pcln         167
internal/cpu.processOptions               internal/c  pcdata0-reg  30
internal/cpu.processOptions               internal/c  pcdata1-sta  60
internal/cpu.processOptions               internal/c  text         1792
internal/cpu.processOptions               internal/c  funcname     28
internal/cpu.indexByte                    internal/c  fixedheader  40
internal/cpu.indexByte                    internal/c  pcsp         9
internal/cpu.indexByte                    internal/c  pcfile       5
internal/cpu.indexByte                    internal/c  pcln         21
internal/cpu.indexByte                    internal/c  pcdata0-reg  22
internal/cpu.indexByte                    internal/c  text         64
internal/cpu.indexByte                    internal/c  funcname     23
internal/cpu.doinit                       internal/c  fixedheader  40
internal/cpu.doinit                       internal/c  pcsp         22
internal/cpu.doinit                       internal/c  pcfile       5
internal/cpu.doinit                       internal/c  pcln         159

etc

For fun bugs to make Go smaller, see https://github.com/golang/go/labels/binary-size

More Repositories

1

homelab

Brad's homelab setup
1,859
star
2

http2

old repo for HTTP/2 support for Go (see README for new home)
Go
1,721
star
3

gomemcache

Go Memcached client library #golang
Go
1,638
star
4

goimports

(old repo) Tool to fix (add, remove) your Go imports automatically.
Go
1,031
star
5

talk-yapc-asia-2015

talk-yapc-asia-2015
Go
709
star
6

exp-httpclient

experimental new HTTP client API for #golang (WIP)
Go
576
star
7

embiggen-disk

embiggden-disk live-resizes a filesystem after first live-resizing any necessary layers below it: an optional LVM LV and PV, and an MBR or GPT partition table
Go
469
star
8

gitbrute

brute-force a git commit hash
Go
375
star
9

latlong

The latlong package maps from a latitude and longitude to a timezone.
Go
374
star
10

iter

Range over integers [0,n). Seriously, that's it.
Go
293
star
11

jndi

a irresponsibly bad logging library
Go
265
star
12

autocertdelegate

Get LetsEncrypt TLS certs for internal-only TLS servers via a delegated golang.org/x/crypto/acme/autocert server.
Go
243
star
13

runsit

THIS IS OLD. DO NOT USE THIS. Just use systemd these days.
Go
217
star
14

go-smtpd

SMTP server library for Go
Go
209
star
15

scanningcabinet

Document Management System (scanner -> appengine blobs)
Python
144
star
16

campher

Embed Perl in Go. This works, but was a joke for a presentation. Don't use.
Go
134
star
17

go-sql-test

test ALL the databases
Go
131
star
18

websomtep

[joke] combination SMTP / WebSocket server
Go
125
star
19

deadbeef

Gimmicky commit hash made using bradfitz/gitbrute
111
star
20

slice

The slice package sorts Go slices.
Go
111
star
21

snake

a #golang Snake game in webassembly running at http://snake.126.49.198.in-addr.arpa/
Go
96
star
22

webfist

WebFist implements WebFinger delegation for providers who don't support WebFinger natively.
Go
84
star
23

android-garage-opener

Android Garage Door Opener
Java
82
star
24

lesser

Go
79
star
25

rfbgo

Toy RFB (VNC) Server in Go (#golang)
Go
73
star
26

go-tool-cache

Go
59
star
27

inboxfewer

archive gmail threads when github or gerrit issues are closed
Go
56
star
28

art

Allotment Routing Table
Go
56
star
29

shipit

Software Release Tool
Perl
55
star
30

gitutil

Utilities for working with git and Gerrit
Go
49
star
31

contributing

(DEAD, SHUT DOWN) a repository of information on how to contribute to open source projects
Python
45
star
32

android-squeezer

Android SqueezeCenter / SqueezeBox remote control client.
Java
35
star
33

undent

unindent stuff
Go
35
star
34

h2slam

slam an HTTP/2 server a lot of concurrent load over a single TCP connection (for debugging something)
Go
28
star
35

zippy-android-talk

Code to accompany my Zippy Android talk at Google I/O 2010
Java
27
star
36

go-issue-mirror

[old] precursor to golang.org/x/build/maintner/godata
24
star
37

goman

Gearman Client for Go
Go
24
star
38

minimal-qemu-linux

experimenting with a minimal Linux kernel under qemu-system for testing
Go
20
star
39

litecmp

Go
19
star
40

ip2asn

parser for iptoasn.com data
Go
18
star
41

hubbub-hub

A PubSubHubbub hub implementation
Perl
18
star
42

sixmap

tool to visualize the SIX (Seattle Internet Exchange) route server coverage
Go
17
star
43

qopher

Gopher Queue
Go
17
star
44

gotsync

parallel tree sync
Go
15
star
45

qemu-guest-kragent

a minimal qemu-guest-agent in Go for gokrazy + Proxmox (qemu)
Go
15
star
46

powerview

Control Hunter Douglas PowerView shades & blinds
Go
14
star
47

grpc-go16-demo

Demonstrating using Go 1.6's http2 to do grpc
Protocol Buffer
14
star
48

go-get-proxy

http proxy for the "go get" subcommand
Go
13
star
49

gce

Go package for for Google Compute Engine (GCE)
Go
13
star
50

sonden

If Sonos is playing audio, turn on my Denon amps.
Go
12
star
51

go-runas

Wrapper around go's rpc pkg to drop root and run RPCs as another user
Go
12
star
52

talk-http2go

HTTP/2 Go Talk
Go
11
star
53

candysim

when will Candyland be over?
Go
11
star
54

morskoyboy

Bored on a bus with no Internet? Play ะœะพั€ัะบะพะน ะ‘ะพะน (Sea Battle), similar to Battleship.
Go
10
star
55

batt

build ALL the things
Go
7
star
56

set-consistenthash-perl

consistent hashing library for Perl
Perl
7
star
57

issue-tracker-behaviors

7
star
58

lingobingo

lingo bingo lightning talk
Go
7
star
59

brackup-gae-server

Brackup server for Google App Engine
Python
6
star
60

eight22er

[joke] Twitter Direct Message POP3 gateway
Go
6
star
61

remserial-mirror

git mirror of remserial
C
5
star
62

talk-2016-08-16-seattle-go-1.7

Go
5
star
63

aoc

advent of code helpers to reuse between tasks
Go
5
star
64

perl-denon-avr-4806

Perl code to control a Denon AVR-4806
4
star
65

unicode-checkutf8

Perl module Unicode::CheckUTF8
Perl
4
star
66

go-mod-archiver-test

Go
4
star
67

perl-net-openid

Perl Net::OpenID::* modules
4
star
68

issuemirror

Code for mirroring Github issues to local files, and reading them.
Go
4
star
69

issue735583

Demo for Chrome issue issue 735583
Go
3
star
70

talk-2014-04-gophercon

Gophercon 2014 Talk
Go
3
star
71

sys-syscall

Sys::Syscall -- access system calls that Perl doesn't normally provide access to
Perl
3
star
72

k9sms

K-9 SMS
3
star
73

barlogalights

little program I use to run the LED strips in my home bar
Go
3
star
74

talk-2012-08-23-square-go

Talk about Go at Square
JavaScript
2
star
75

fotobilder-spiegel

Mirror photos & galleries from FotoBilder / LiveJournal
Go
2
star
76

democgoalloc

Go
2
star
77

fw-test-agent

Go
1
star
78

go-test-bug-repro

Go
1
star
79

wintun-go

dev fork of golang.zx2c4.com/wintun
Go
1
star
80

talk-gluecon-2010

Slides & code samples from my Gluecon 2010 talk
Perl
1
star