summaryrefslogtreecommitdiff
path: root/src/cmd/internal/bio/buf.go
Commit message (Collapse)AuthorAgeFilesLines
* [dev.link] cmd/internal/objfile: read Go object file using goobj2 packageCherry Zhang2020-08-111-1/+6
| | | | | | | | | | | | | Read Go object files using cmd/internal/goobj2 package directly, instead of using cmd/internal/goobj as an intermediate layer. Now cmd/internal/archive is only about reading archives. Change-Id: Ifecb217fb26c16c26fc1bbc3fba0ed44710020ed Reviewed-on: https://go-review.googlesource.com/c/go/+/246443 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
* cmd/internal/bio: rename Reader.Seek to MustSeekRuss Cox2019-05-091-2/+2
| | | | | | | | | | | | | | | | | | Renaming the method makes clear, both to readers and to vet, that this method is not the implementation of io.Seeker: it cannot fail. Working toward making the tree vet-safe instead of having so many exceptions in cmd/vet/all/whitelist. For #31916. Change-Id: I3e6ad7264cb0121b4b76935450cccb71d533e96b Reviewed-on: https://go-review.googlesource.com/c/go/+/176108 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/link: use read-only mmap to back selected symbol name stringsThan McIntosh2019-04-251-0/+12
| | | | | | | | | | | | | | | When reading symbol names from an object file, if a name does not need fixup (conversion of "". to package path), then generate a string whose backing store is in read-only memory (from an mmap of the object file), avoiding the need for an allocation. This yields a modest reduction in total linker heap use. Change-Id: I95719c93026b6cc82eb6947a9d14063cf3a6679c Reviewed-on: https://go-review.googlesource.com/c/go/+/173938 Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/link: mmap object dataCherry Zhang2019-04-191-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | This resurrects CL 121198, except that this time we map read-only. In case that we need to apply relocations to the symbol's content that is backed by read-only memory, we do our own copy- on-write. This can happen if we failed to mmap the output file, or we build for Wasm. Memory profile for building k8s.io/kubernetes/cmd/kube-apiserver on Linux/AMD64: Old (before this sequence of CLs): inuse_space 1598.75MB total 669.87MB 41.90% 41.90% 669.87MB 41.90% cmd/link/internal/objfile.(*objReader).readSlices New: inuse_space 1280.45MB total 441.18MB 34.46% 34.46% 441.18MB 34.46% cmd/link/internal/objfile.(*objReader).readSlices Change-Id: I6b4d29d6eee9828089ea3120eb38c212db21330b Reviewed-on: https://go-review.googlesource.com/c/go/+/170741 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/compile: add indexed export formatMatthew Dempsky2018-04-241-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL introduces a new indexed data format for package export data. This improves on the previous (sequential) binary format by allowing the compiler to selectively (and lazily) load only the data that's actually needed for compilation. In large Go projects, the package export data can become very large due to transitive type declaration dependencies and inline function/method bodies. By lazily loading these declarations and bodies as needed, we avoid wasting time and memory processing unnecessary and/or redundant data. In the benchmarks below, "old" is -iexport=false and "new" is -iexport=true. The suffixes indicate the compiler concurrency (-c) and inlining (-l) settings used for the build (using -gcflags=all=-foo). Benchmarks were run on an HP Z620. Juju is "go build -a github.com/juju/juju/cmd/...": name old real-time/op new real-time/op delta Juju/c=1/l=0 44.0s ± 1% 38.7s ± 9% -11.97% (p=0.001 n=7+7) Juju/c=1/l=4 53.7s ± 3% 45.3s ± 4% -15.53% (p=0.001 n=7+7) Juju/c=4/l=0 39.7s ± 8% 32.0s ± 4% -19.38% (p=0.001 n=7+7) Juju/c=4/l=4 46.3s ± 4% 38.0s ± 4% -18.06% (p=0.001 n=7+7) name old user-time/op new user-time/op delta Juju/c=1/l=0 371s ± 1% 300s ± 0% -19.07% (p=0.001 n=7+6) Juju/c=1/l=4 482s ± 0% 374s ± 1% -22.37% (p=0.001 n=7+7) Juju/c=4/l=0 410s ± 1% 340s ± 1% -17.19% (p=0.001 n=7+7) Juju/c=4/l=4 532s ± 1% 424s ± 1% -20.26% (p=0.001 n=7+7) name old sys-time/op new sys-time/op delta Juju/c=1/l=0 33.4s ± 1% 28.4s ± 2% -15.02% (p=0.001 n=7+7) Juju/c=1/l=4 40.7s ± 2% 32.8s ± 3% -19.51% (p=0.001 n=7+7) Juju/c=4/l=0 39.8s ± 2% 34.4s ± 2% -13.74% (p=0.001 n=7+7) Juju/c=4/l=4 48.4s ± 2% 40.4s ± 2% -16.50% (p=0.001 n=7+7) Kubelet is "go build -a k8s.io/kubernetes/cmd/kubelet": name old real-time/op new real-time/op delta Kubelet/c=1/l=0 42.0s ± 1% 34.8s ± 1% -17.27% (p=0.008 n=5+5) Kubelet/c=1/l=4 55.4s ± 3% 45.4s ± 3% -18.06% (p=0.002 n=6+6) Kubelet/c=4/l=0 37.4s ± 3% 29.9s ± 1% -20.25% (p=0.004 n=6+5) Kubelet/c=4/l=4 48.1s ± 2% 39.0s ± 5% -18.93% (p=0.002 n=6+6) name old user-time/op new user-time/op delta Kubelet/c=1/l=0 291s ± 1% 233s ± 1% -19.96% (p=0.002 n=6+6) Kubelet/c=1/l=4 385s ± 1% 298s ± 1% -22.51% (p=0.002 n=6+6) Kubelet/c=4/l=0 325s ± 0% 268s ± 1% -17.48% (p=0.004 n=5+6) Kubelet/c=4/l=4 429s ± 1% 343s ± 1% -20.08% (p=0.002 n=6+6) name old sys-time/op new sys-time/op delta Kubelet/c=1/l=0 25.1s ± 2% 20.9s ± 4% -16.69% (p=0.002 n=6+6) Kubelet/c=1/l=4 31.2s ± 3% 24.4s ± 0% -21.67% (p=0.010 n=6+4) Kubelet/c=4/l=0 30.2s ± 2% 25.6s ± 1% -15.34% (p=0.002 n=6+6) Kubelet/c=4/l=4 37.3s ± 1% 30.9s ± 2% -17.11% (p=0.002 n=6+6) Change-Id: Ie43eb3bbe1392cbb61c86792a17a57b33b9561f0 Reviewed-on: https://go-review.googlesource.com/106796 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
* cmd/internal/obj: remove use of package bioMatthew Dempsky2016-04-141-1/+1
| | | | | | | | | | | Also add MustClose and MustWriter to cmd/internal/bio, and use them in cmd/asm. Change-Id: I07f5df3b66c17bc5b2e6ec9c4357d9b653e354e0 Reviewed-on: https://go-review.googlesource.com/21938 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd: remove bio.BreadMarvin Stenger2016-04-101-11/+0
| | | | | | | | Replace calls to bio.Bread with calls to io.ReadFull. Change-Id: I2ee8739d01e04a4da9c20b6ce7d1d5b89914b8ad Reviewed-on: https://go-review.googlesource.com/21750 Reviewed-by: Dave Cheney <dave@cheney.net>
* cmd/internal/bio: move Bgetc to link/internal/ldDave Cheney2016-04-091-21/+0
| | | | | | | | | Also, remove bio.Brdline. Change-Id: I3e0caed27a373fd71737cf6892de5e8fc208b776 Reviewed-on: https://go-review.googlesource.com/21783 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Dave Cheney <dave@cheney.net>
* cmd/internal/bio: embed bufio.{Reader,Writer} in bio.{Reader,Writer}Dave Cheney2016-04-091-43/+13
| | | | | | Change-Id: Ie95b0b0d4f724f4769cf2d4f8063cb5019fa9bc9 Reviewed-on: https://go-review.googlesource.com/21781 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd: remove bio.BufReader and bio.BufWriterDave Cheney2016-04-091-12/+0
| | | | | | | | | | | | | | bio.BufReader was never used. bio.BufWriter was used to wrap an existing io.Writer, but the bio.Writer returned would not be seekable, so replace all occurences with bufio.Reader instead. Change-Id: I9c6779e35c63178aa4e104c17bb5bb8b52de0359 Reviewed-on: https://go-review.googlesource.com/21722 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Dave Cheney <dave@cheney.net> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd: replace bio.Buf with bio.Reader and bio.WriterDave Cheney2016-04-081-57/+80
| | | | | | | | | | | Replace the bidirectional bio.Buf type with a pair of unidirectional buffered seekable Reader and Writers. Change-Id: I86664a06f93c94595dc67c2cbd21356feb6680ef Reviewed-on: https://go-review.googlesource.com/21720 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Dave Cheney <dave@cheney.net> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd: extract obj's Biobuf code into new bio packageMatthew Dempsky2016-04-071-0/+150
API could still be made more Go-ey. Updates #15165. Change-Id: I514ffceffa43c293ae5d7e5f1e9193fda0098865 Reviewed-on: https://go-review.googlesource.com/21644 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>