• Shahar Kohanim's avatar
    cmd/link, cmd/compile: Add symbol references to object file. · 3648d2d4
    Shahar Kohanim authored
    Symbols in the object file currently refer to each other using symbol name
    and version. Referring to the same symbol many times in an object file takes
    up space and causes redundant map lookups. Instead write out a list of unique
    symbol references and have symbols refer to each other using indexes into this
    list.
    
    Credit to Michael Hudson-Doyle for kicking this off.
    
    Reduces pkg/linux_amd64 size by 30% from 61MB to 43MB
    
    name       old s/op   new s/op   delta
    LinkCmdGo  0.74 ± 3%  0.63 ± 4%  -15.22%  (p=0.000 n=20+20)
    LinkJuju   6.38 ± 6%  5.73 ± 6%  -10.16%  (p=0.000 n=20+19)
    
    Change-Id: I7e101a0c80b8e673a3ba688295e6f80ea04e1cfb
    Reviewed-on: https://go-review.googlesource.com/20099Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
    Run-TryBot: David Crawshaw <crawshaw@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    3648d2d4
link.go 20.8 KB