| Age | Commit message (Collapse) | Author |
|
While the comments are on an unexported type, gopls correctly
shows them when using the exported vars LittleEndian and BigEndian.
Fixes #68083
Change-Id: I53668c3140ad00f7b58437be74e6df773e2916f1
GitHub-Last-Rev: cef717123cdc632b59683f4ce55aee6c286ca4c7
GitHub-Pull-Request: golang/go#71058
Reviewed-on: https://go-review.googlesource.com/c/go/+/638936
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
|
|
Change-Id: I07e7c8eaa5bd4bac0d576b2f2f4cd3f81b0b77a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/630055
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
|
|
Updates #60023
Change-Id: Ida1cc6c4f5537402e11db6b8c411828f2bcc0a5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/587096
Reviewed-by: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
|
|
Size() is currently not called from the fast path, since the package
handles the buffer sizing for Read and Write internally. This will change
when adding Append() because callers can use Size to avoid allocations when
writing into bytes.Buffer via AvailableBuffer for example.
Add a fast path for simple types and extend the existing struct size cache
to arrays of structs.
Change-Id: I3af16a2b6c9e2dbe6166a2f8c96bcd2e936719e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/584358
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Austin Clements <austin@google.com>
|
|
Add a function which appends the binary representation of a value to the end of a slice.
This allows users to encode values with zero allocations. Also add Encode and Decode
functions which mimic unicode/utf8.
goos: darwin
goarch: arm64
pkg: encoding/binary
cpu: Apple M1 Pro
│ base.txt │ append.txt │
│ sec/op │ sec/op vs base │
ReadSlice1000Int32s-10 2.690µ ± 0% 2.532µ ± 3% -5.86% (p=0.002 n=6)
ReadStruct-10 205.8n ± 0% 201.4n ± 1% -2.14% (p=0.002 n=6)
WriteStruct-10 159.1n ± 0% 153.5n ± 0% -3.55% (p=0.002 n=6)
WriteSlice1000Structs-10 129.8µ ± 0% 124.2µ ± 0% -4.34% (p=0.002 n=6)
ReadSlice1000Structs-10 161.7µ ± 0% 160.3µ ± 0% -0.89% (p=0.002 n=6)
ReadInts-10 156.8n ± 0% 161.6n ± 0% +3.09% (p=0.002 n=6)
WriteInts-10 134.5n ± 0% 139.5n ± 2% +3.72% (p=0.002 n=6)
WriteSlice1000Int32s-10 2.691µ ± 16% 2.551µ ± 4% -5.20% (p=0.002 n=6)
PutUint16-10 0.6448n ± 4% 0.6212n ± 1% ~ (p=0.093 n=6)
AppendUint16-10 1.414n ± 0% 1.424n ± 1% ~ (p=0.115 n=6)
PutUint32-10 0.6210n ± 0% 0.6211n ± 0% ~ (p=0.833 n=6)
AppendUint32-10 1.414n ± 0% 1.426n ± 1% +0.85% (p=0.017 n=6)
PutUint64-10 0.6210n ± 0% 0.6394n ± 1% +2.95% (p=0.002 n=6)
AppendUint64-10 1.414n ± 0% 1.427n ± 2% ~ (p=0.052 n=6)
LittleEndianPutUint16-10 0.6239n ± 0% 0.6271n ± 1% ~ (p=0.063 n=6)
LittleEndianAppendUint16-10 1.421n ± 0% 1.432n ± 1% +0.81% (p=0.002 n=6)
LittleEndianPutUint32-10 0.6240n ± 0% 0.6240n ± 0% ~ (p=0.766 n=6)
LittleEndianAppendUint32-10 1.422n ± 1% 1.425n ± 0% ~ (p=0.673 n=6)
LittleEndianPutUint64-10 0.6242n ± 0% 0.6238n ± 0% -0.08% (p=0.030 n=6)
LittleEndianAppendUint64-10 1.420n ± 0% 1.449n ± 1% +2.04% (p=0.002 n=6)
ReadFloats-10 39.36n ± 0% 42.54n ± 1% +8.08% (p=0.002 n=6)
WriteFloats-10 33.65n ± 0% 35.27n ± 1% +4.80% (p=0.002 n=6)
ReadSlice1000Float32s-10 2.656µ ± 0% 2.526µ ± 1% -4.91% (p=0.002 n=6)
WriteSlice1000Float32s-10 2.765µ ± 0% 2.857µ ± 3% +3.31% (p=0.002 n=6)
ReadSlice1000Uint8s-10 129.1n ± 1% 130.4n ± 1% ~ (p=0.126 n=6)
WriteSlice1000Uint8s-10 144.90n ± 3% 18.67n ± 2% -87.12% (p=0.002 n=6)
PutUvarint32-10 12.11n ± 0% 12.12n ± 0% ~ (p=0.675 n=6)
PutUvarint64-10 30.82n ± 0% 30.79n ± 1% ~ (p=0.658 n=6)
AppendStruct-10 107.8n ± 0%
AppendSlice1000Structs-10 119.0µ ± 0%
AppendInts-10 55.29n ± 0%
AppendSlice1000Int32s-10 2.211µ ± 1%
geomean 33.07n 48.18n -7.03%
Fixes #60023
Change-Id: Ife3f217b11d5f3eaa5a53fe8a7e877552f751f94
Reviewed-on: https://go-review.googlesource.com/c/go/+/579157
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Ingo Oeser <nightlyone@googlemail.com>
Reviewed-by: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
Remove some duplicate type switching from encoder.value. reflect.Uint and
reflect.Int don't have a case statement anymore, but since they aren't valid
types there is no change in semantics.
goos: darwin
goarch: arm64
pkg: encoding/binary
cpu: Apple M1 Pro
│ base.txt │ simplify.txt │
│ sec/op │ sec/op vs base │
ReadSlice1000Int32s-10 2.649µ ± 1% 2.645µ ± 0% ~ (p=0.069 n=6)
ReadStruct-10 204.8n ± 2% 199.9n ± 0% -2.39% (p=0.002 n=6)
WriteStruct-10 185.6n ± 2% 154.0n ± 0% -17.03% (p=0.002 n=6)
WriteSlice1000Structs-10 157.9µ ± 1% 125.0µ ± 0% -20.86% (p=0.002 n=6)
ReadSlice1000Structs-10 162.6µ ± 2% 159.3µ ± 0% ~ (p=0.065 n=6)
ReadInts-10 159.7n ± 1% 156.7n ± 0% -1.88% (p=0.002 n=6)
WriteInts-10 134.2n ± 0% 134.1n ± 0% -0.11% (p=0.011 n=6)
WriteSlice1000Int32s-10 2.680µ ± 0% 2.680µ ± 0% ~ (p=0.955 n=6)
PutUint16-10 0.6253n ± 2% 0.6211n ± 0% -0.67% (p=0.013 n=6)
AppendUint16-10 1.417n ± 2% 1.413n ± 0% ~ (p=0.065 n=6)
PutUint32-10 0.6210n ± 0% 0.6210n ± 0% ~ (p=0.835 n=6)
AppendUint32-10 1.414n ± 0% 1.414n ± 0% ~ (p=1.000 n=6)
PutUint64-10 0.6210n ± 0% 0.6212n ± 0% ~ (p=0.260 n=6)
AppendUint64-10 1.414n ± 1% 1.417n ± 0% ~ (p=0.097 n=6)
LittleEndianPutUint16-10 0.6236n ± 0% 0.6238n ± 0% ~ (p=0.426 n=6)
LittleEndianAppendUint16-10 1.419n ± 0% 1.421n ± 1% ~ (p=0.054 n=6)
LittleEndianPutUint32-10 0.6236n ± 0% 0.6239n ± 0% ~ (p=0.457 n=6)
LittleEndianAppendUint32-10 1.421n ± 3% 1.421n ± 0% ~ (p=1.000 n=6)
LittleEndianPutUint64-10 0.6242n ± 1% 0.6239n ± 0% ~ (p=0.372 n=6)
LittleEndianAppendUint64-10 1.421n ± 0% 1.421n ± 0% ~ (p=1.000 n=6)
ReadFloats-10 39.39n ± 0% 39.35n ± 0% -0.10% (p=0.026 n=6)
WriteFloats-10 33.64n ± 0% 33.65n ± 0% ~ (p=0.297 n=6)
ReadSlice1000Float32s-10 2.661µ ± 0% 2.664µ ± 0% ~ (p=0.916 n=6)
WriteSlice1000Float32s-10 2.763µ ± 0% 2.758µ ± 2% ~ (p=0.225 n=6)
ReadSlice1000Uint8s-10 129.5n ± 2% 129.5n ± 2% ~ (p=0.485 n=6)
WriteSlice1000Uint8s-10 144.4n ± 4% 146.1n ± 2% ~ (p=0.065 n=6)
PutUvarint32-10 12.12n ± 0% 12.12n ± 2% ~ (p=0.933 n=6)
PutUvarint64-10 30.75n ± 0% 31.29n ± 1% +1.76% (p=0.002 n=6)
geomean 33.44n 32.89n -1.65%
Change-Id: Ibce978012c268a7f26fe7567c340c861fa4b115d
Reviewed-on: https://go-review.googlesource.com/c/go/+/579156
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
structs.
A lot of allocations happen in dataSize due to reflection.
Cache the result of the function when encoding a
slice of structs similar to what is done for struct types
so that subsequent calls to dataSize can avoid allocations.
│ old.txt │ new.txt │
│ sec/op │ sec/op vs base │
WriteSlice1000Structs-2 846.7µ ± 4% 856.4µ ± 3% ~ (p=0.602 n=20)
│ old.txt │ new.txt │
│ B/s │ B/s vs base │
WriteSlice1000Structs-2 84.48Mi ± 4% 83.52Mi ± 3% ~ (p=0.602 n=20)
│ old.txt │ new.txt │
│ B/op │ B/op vs base │
WriteSlice1000Structs-2 80.18Ki ± 0% 80.06Ki ± 0% -0.15% (p=0.000 n=20)
│ old.txt │ new.txt │
│ allocs/op │ allocs/op vs base │
WriteSlice1000Structs-2 16.000 ± 0% 1.000 ± 0% -93.75% (p=0.000 n=2
│ old.txt │ new.txt │
│ sec/op │ sec/op vs base │
ReadSlice1000Structs-2 847.4µ ± 4% 821.1µ ± 3% -3.10% (p=0.012 n=20)
│ old.txt │ new.txt │
│ B/s │ B/s vs base │
ReadSlice1000Structs-2 84.40Mi ± 4% 87.11Mi ± 3% +3.20% (p=0.012 n=20)
│ old.txt │ new.txt │
│ B/op │ B/op vs base │
ReadSlice1000Structs-2 80.12Ki ± 0% 80.00Ki ± 0% -0.15% (p=0.000 n=20)
│ old.txt │ new.txt │
│ allocs/op │ allocs/op vs base │
ReadSlice1000Structs-2 16.000 ± 0% 1.000 ± 0% -93.75% (p=0.000 n=20)
Fixes #66253
Change-Id: I8227e61306db1fe103489ea4fee2429247c3debc
Reviewed-on: https://go-review.googlesource.com/c/go/+/570855
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
|
|
Change-Id: I2f3c7f4a4848ad0fbbf79bd8919b1e2abee72f3f
GitHub-Last-Rev: 06d0047b28fe1c8c87f84aca049b8c76778732b9
GitHub-Pull-Request: golang/go#66136
Reviewed-on: https://go-review.googlesource.com/c/go/+/569280
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
|
|
Across all encoding packages, linkify declarations if possible.
In some cases, we convert a code block into a bulleted list,
which then further allows for more linkification.
Change-Id: I68fedf362615b34228bab5d4859b7d87d831c570
Reviewed-on: https://go-review.googlesource.com/c/go/+/524977
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
Size is defined as returning -1 if the type is not fixed-size.
Before this CL cases like Size((*[]int)(nil)) would crash.
Fixes #60892
Change-Id: Iee8e20a0aee24b542b78cb4160c3b2c5a3eb02c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/504575
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
|
|
Test added.
Fixes #22860
Change-Id: I08304834a2b7b10b4ac729bf36761692eb4731da
Reviewed-on: https://go-review.googlesource.com/c/go/+/113075
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
|
|
Updates #57237
Change-Id: Ib626610130cae9c1d1aff5dd2a5035ffde0e127f
Reviewed-on: https://go-review.googlesource.com/c/go/+/463985
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
|
|
AppendByteOrder specifies new methods for LittleEndian and BigEndian
for appending an unsigned integer to a byte slice.
The performance of AppendXXX methods are slower than PutXXX methods
since the former needs to do a few slice operations,
while the latter is essentially a single integer store.
In practice, existing usages of PutXXX performed slicing operations
around the call such that this cost was present, regardless.
name time/op
PutUint16-24 0.48ns ± 2%
AppendUint16-24 1.54ns ± 1%
PutUint32-24 0.46ns ± 2%
AppendUint32-24 0.89ns ± 1%
PutUint64-24 0.46ns ± 2%
AppendUint64-24 0.89ns ± 1%
LittleEndianPutUint16-24 0.47ns ± 2%
LittleEndianAppendUint16-24 1.54ns ± 1%
LittleEndianPutUint32-24 0.45ns ± 3%
LittleEndianAppendUint32-24 0.92ns ± 2%
LittleEndianPutUint64-24 0.46ns ± 3%
LittleEndianAppendUint64-24 0.95ns ± 4%
Fixes #50601
Change-Id: I33d2bbc93a3ce01a9269feac33a2432bc1166ead
Reviewed-on: https://go-review.googlesource.com/c/go/+/386017
Trust: Joseph Tsai <joetsai@digital-static.net>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
|
|
And then revert the bootstrap cmd directories and certain testdata.
And adjust tests as needed.
Not reverting the changes in std that are bootstrapped,
because some of those changes would appear in API docs,
and we want to use any consistently.
Instead, rewrite 'any' to 'interface{}' in cmd/dist for those directories
when preparing the bootstrap copy.
A few files changed as a result of running gofmt -w
not because of interface{} -> any but because they
hadn't been updated for the new //go:build lines.
Fixes #49884.
Change-Id: Ie8045cba995f65bd79c694ec77a1b3d1fe01bb09
Reviewed-on: https://go-review.googlesource.com/c/go/+/368254
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
|
|
Updates #47651
Updates #48665
Change-Id: I69a87b45a5cad7a07fbd855040cd9935cf874554
Reviewed-on: https://go-review.googlesource.com/c/go/+/358454
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
|
|
Benchmarks:
goos: linux
goarch: amd64
BenchmarkReadSlice1000Uint8s-8 4097088 296 ns/op 3381.06 MB/s
BenchmarkWriteSlice1000Uint8s-8 4372588 271 ns/op 3694.96 MB/s
Change-Id: I5b6ef0da5052e3381ee9c714bbff541c11ed0259
Reviewed-on: https://go-review.googlesource.com/c/go/+/246837
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
|
|
This adds float type support to the main switch blocks in Read and
Write, instead of falling back to reflection. This gives a considerable
speedup for the float types:
ReadFloats-8 129ns ± 9% 70ns ± 8% -46.02% (p=0.001 n=7+7)
WriteFloats-8 131ns ± 6% 86ns ±11% -34.59% (p=0.001 n=7+7)
ReadSlice1000Float32s-8 14.6µs ±14% 4.8µs ±12% -67.29% (p=0.001 n=7+7)
WriteSlice1000Float32s-8 16.4µs ±20% 4.7µs ± 8% -71.01% (p=0.001 n=7+7)
Change-Id: I0be99d068b07d10dd6eb1137b45eff6f7c216b87
GitHub-Last-Rev: 4ff326e99ca35977d819f0ba29c10d9efc7e811c
GitHub-Pull-Request: golang/go#31803
Reviewed-on: https://go-review.googlesource.com/c/go/+/174959
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
|
|
Make binary.Read return an error when passed `data` argument is not
a pointer to a fixed-size value or a slice of fixed-size values.
Fixes #32927
Change-Id: I04f48be55fe9b0cc66c983d152407d0e42cbcd95
Reviewed-on: https://go-review.googlesource.com/c/go/+/184957
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
|
|
A majority of work is spent in dataSize when en/decoding the same
struct over and over again. This wastes a lot of work, since
the result doesn't change for a given reflect.Value.
Cache the result of the function for structs, so that subsequent
calls to dataSize can avoid doing work.
name old time/op new time/op delta
ReadStruct 1.00µs ± 1% 0.37µs ± 1% -62.99% (p=0.029 n=4+4)
WriteStruct 1.00µs ± 3% 0.37µs ± 1% -62.69% (p=0.008 n=5+5)
name old speed new speed delta
ReadStruct 75.1MB/s ± 1% 202.9MB/s ± 1% +170.16% (p=0.029 n=4+4)
WriteStruct 74.8MB/s ± 3% 200.4MB/s ± 1% +167.96% (p=0.008 n=5+5)
Fixes #34471
Change-Id: Ic5d987ca95f1197415ef93643a0af6fc1224fdf0
Reviewed-on: https://go-review.googlesource.com/c/go/+/199539
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
|
There's no need to manually manage the backing slice for bs.
Removing it simplifies the code, removes some allocations,
and speeds it up slightly.
Fixes #27403
name old time/op new time/op delta
ReadSlice1000Int32s-8 6.39µs ± 1% 6.31µs ± 1% -1.37% (p=0.000 n=27+27)
ReadStruct-8 1.25µs ± 2% 1.23µs ± 2% -1.06% (p=0.003 n=30+29)
ReadInts-8 301ns ± 0% 297ns ± 1% -1.21% (p=0.000 n=27+30)
WriteInts-8 325ns ± 1% 320ns ± 1% -1.59% (p=0.000 n=26+29)
WriteSlice1000Int32s-8 6.60µs ± 0% 6.52µs ± 0% -1.23% (p=0.000 n=28+27)
PutUint16-8 0.72ns ± 2% 0.71ns ± 2% ~ (p=0.286 n=30+30)
PutUint32-8 0.71ns ± 1% 0.71ns ± 0% -0.42% (p=0.003 n=30+25)
PutUint64-8 0.78ns ± 2% 0.78ns ± 0% -0.55% (p=0.001 n=30+27)
LittleEndianPutUint16-8 0.57ns ± 0% 0.57ns ± 0% ~ (all equal)
LittleEndianPutUint32-8 0.57ns ± 0% 0.57ns ± 0% ~ (all equal)
LittleEndianPutUint64-8 0.57ns ± 0% 0.57ns ± 0% ~ (all equal)
PutUvarint32-8 23.1ns ± 1% 23.1ns ± 1% ~ (p=0.925 n=26+29)
PutUvarint64-8 57.5ns ± 2% 57.3ns ± 1% ~ (p=0.338 n=30+26)
[Geo mean] 23.0ns 22.9ns -0.61%
name old speed new speed delta
ReadSlice1000Int32s-8 626MB/s ± 1% 634MB/s ± 1% +1.38% (p=0.000 n=27+27)
ReadStruct-8 60.2MB/s ± 2% 60.8MB/s ± 2% +1.08% (p=0.002 n=30+29)
ReadInts-8 100MB/s ± 1% 101MB/s ± 1% +1.24% (p=0.000 n=27+30)
WriteInts-8 92.2MB/s ± 1% 93.6MB/s ± 1% +1.56% (p=0.000 n=26+29)
WriteSlice1000Int32s-8 606MB/s ± 0% 614MB/s ± 0% +1.24% (p=0.000 n=28+27)
PutUint16-8 2.80GB/s ± 1% 2.80GB/s ± 1% ~ (p=0.095 n=28+29)
PutUint32-8 5.61GB/s ± 1% 5.62GB/s ± 1% ~ (p=0.069 n=27+28)
PutUint64-8 10.2GB/s ± 1% 10.2GB/s ± 0% +0.15% (p=0.039 n=27+27)
LittleEndianPutUint16-8 3.50GB/s ± 1% 3.50GB/s ± 1% ~ (p=0.552 n=30+29)
LittleEndianPutUint32-8 7.01GB/s ± 1% 7.02GB/s ± 1% ~ (p=0.160 n=29+27)
LittleEndianPutUint64-8 14.0GB/s ± 1% 14.0GB/s ± 1% ~ (p=0.413 n=29+29)
PutUvarint32-8 174MB/s ± 1% 173MB/s ± 1% ~ (p=0.648 n=25+30)
PutUvarint64-8 139MB/s ± 2% 140MB/s ± 1% ~ (p=0.271 n=30+26)
[Geo mean] 906MB/s 911MB/s +0.55%
name old alloc/op new alloc/op delta
ReadSlice1000Int32s-8 4.14kB ± 0% 4.13kB ± 0% -0.19% (p=0.000 n=30+30)
ReadStruct-8 200B ± 0% 200B ± 0% ~ (all equal)
ReadInts-8 64.0B ± 0% 32.0B ± 0% -50.00% (p=0.000 n=30+30)
WriteInts-8 112B ± 0% 64B ± 0% -42.86% (p=0.000 n=30+30)
WriteSlice1000Int32s-8 4.14kB ± 0% 4.13kB ± 0% -0.19% (p=0.000 n=30+30)
PutUint16-8 0.00B 0.00B ~ (all equal)
PutUint32-8 0.00B 0.00B ~ (all equal)
PutUint64-8 0.00B 0.00B ~ (all equal)
LittleEndianPutUint16-8 0.00B 0.00B ~ (all equal)
LittleEndianPutUint32-8 0.00B 0.00B ~ (all equal)
LittleEndianPutUint64-8 0.00B 0.00B ~ (all equal)
PutUvarint32-8 0.00B 0.00B ~ (all equal)
PutUvarint64-8 0.00B 0.00B ~ (all equal)
[Geo mean] 476B 370B -22.22%
name old allocs/op new allocs/op delta
ReadSlice1000Int32s-8 3.00 ± 0% 2.00 ± 0% -33.33% (p=0.000 n=30+30)
ReadStruct-8 16.0 ± 0% 16.0 ± 0% ~ (all equal)
ReadInts-8 8.00 ± 0% 8.00 ± 0% ~ (all equal)
WriteInts-8 14.0 ± 0% 14.0 ± 0% ~ (all equal)
WriteSlice1000Int32s-8 3.00 ± 0% 2.00 ± 0% -33.33% (p=0.000 n=30+30)
PutUint16-8 0.00 0.00 ~ (all equal)
PutUint32-8 0.00 0.00 ~ (all equal)
PutUint64-8 0.00 0.00 ~ (all equal)
LittleEndianPutUint16-8 0.00 0.00 ~ (all equal)
LittleEndianPutUint32-8 0.00 0.00 ~ (all equal)
LittleEndianPutUint64-8 0.00 0.00 ~ (all equal)
PutUvarint32-8 0.00 0.00 ~ (all equal)
PutUvarint64-8 0.00 0.00 ~ (all equal)
[Geo mean] 6.94 5.90 -14.97%
Change-Id: I3790b93e4190d98621d5f2c47e42929a18f56c2e
Reviewed-on: https://go-review.googlesource.com/133135
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
|
|
intDataSize should return length of bool slice, so functions
Read and Write can use the fast path to process bool slice.
Change-Id: I8cd275e3ffea82024850662d86caca64bd91bf70
Reviewed-on: https://go-review.googlesource.com/112135
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
|
|
While running make.bash, over 5% of all pointer writes
come from encoding/binary doing struct reads.
This change replaces slicing during such reads with an offset.
This avoids updating the slice pointer with every
struct field read or write.
This has no impact when the write barrier is off.
Running the benchmarks with GOGC=1, however,
shows significant improvement:
name old time/op new time/op delta
ReadStruct-8 13.2µs ± 6% 10.1µs ± 5% -23.24% (p=0.000 n=10+10)
name old speed new speed delta
ReadStruct-8 5.69MB/s ± 6% 7.40MB/s ± 5% +30.18% (p=0.000 n=10+10)
Change-Id: I22904263196bfeddc38abe8989428e263aee5253
Reviewed-on: https://go-review.googlesource.com/98757
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
|
|
Fixes #19794
Change-Id: I462cbc432fe9d4a9e6e79a9833b0013d82a0780e
Reviewed-on: https://go-review.googlesource.com/47093
Reviewed-by: Ian Lance Taylor <iant@golang.org>
|
|
Updates #16856
Change-Id: I57af6b0c0d5ecdaf19cf6f969b05ec9ec03058f1
Reviewed-on: https://go-review.googlesource.com/33756
Reviewed-by: Ian Lance Taylor <iant@golang.org>
|
|
This change adds support for decoding and encoding the bool type. The
encoding is a single byte, with a zero value for false and a non-zero
value for true.
Closes #16856.
Change-Id: I1d1114b320263691473bb100cad0f380e0204186
Reviewed-on: https://go-review.googlesource.com/28514
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
|
|
cmd and runtime were handled separately, and I'm intentionally skipped
syscall. This is the rest of the standard library.
CL generated mechanically with github.com/mdempsky/unconvert.
Change-Id: I9e0eff886974dedc37adb93f602064b83e469122
Reviewed-on: https://go-review.googlesource.com/22104
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
|
Find comparisons to constants and propagate that information
down the dominator tree. Use it to resolve other constant
comparisons on the same variable.
So if we know x >= 7, then a x > 4 condition must return true.
This change allows us to use "_ = b[7]" hints to eliminate bounds checks.
Fixes #14900
Change-Id: Idbf230bd5b7da43de3ecb48706e21cf01bf812f7
Reviewed-on: https://go-review.googlesource.com/21008
Reviewed-by: Alexandru Moșoi <alexandru@mosoi.ro>
|
|
The inserted early bound checks cause the slice
to expand beyond the original length of the slice.
Change-Id: Ib38891605f4a9a12d3b9e2071a5f77640b083d2d
Reviewed-on: https://go-review.googlesource.com/20981
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
|
|
* This the simplest solution I could came up with
that doesn't required changing the compiler.
* The bound checks become constants now
so they are removed during opt phase.
Updates #14808
Change-Id: If32c33d7ec08bb400321b465015d152f0a5d3001
Reviewed-on: https://go-review.googlesource.com/20654
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
|
This is a subset of https://golang.org/cl/20022 with only the copyright
header lines, so the next CL will be smaller and more reviewable.
Go policy has been single space after periods in comments for some time.
The copyright header template at:
https://golang.org/doc/contribute.html#copyright
also uses a single space.
Make them all consistent.
Change-Id: Icc26c6b8495c3820da6b171ca96a74701b4a01b0
Reviewed-on: https://go-review.googlesource.com/20111
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
|
Also add a unit test to lock this behavior into the API.
Fixes #12016
Change-Id: Ib6ec6e7948f0705f3504ede9143b5dc4e790fc44
Reviewed-on: https://go-review.googlesource.com/15171
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
|
Updated the protobuf documentation URL (code.google.com deprecated)
to avoid a redirect.
Change-Id: I134f6e4a2bf2bba699942883bf6347bc61700bcb
Reviewed-on: https://go-review.googlesource.com/11634
Reviewed-by: Russ Cox <rsc@golang.org>
|
|
Change-Id: I91f9b5280e08e005f5a891aaa249267c211d814b
Reviewed-on: https://go-review.googlesource.com/7592
Reviewed-by: Minux Ma <minux@golang.org>
|
|
intDataSize ignores unsigned integers, forcing reads/writes to miss the fast path.
Fixes #8956
Change-Id: Ie79b565b037db3c469aa1dc6d0a8a5a9252d5f0a
Reviewed-on: https://go-review.googlesource.com/1777
Reviewed-by: Russ Cox <rsc@golang.org>
|
|
In the process, simplified internal sizeOf and
dataSize functions. Minor positive impact on
performance. Added test case.
benchmark old ns/op new ns/op delta
BenchmarkReadSlice1000Int32s 14006 14122 +0.83%
BenchmarkReadStruct 2508 2447 -2.43%
BenchmarkReadInts 921 928 +0.76%
BenchmarkWriteInts 2086 2081 -0.24%
BenchmarkWriteSlice1000Int32s 13440 13497 +0.42%
BenchmarkPutUvarint32 28.5 26.3 -7.72%
BenchmarkPutUvarint64 81.3 76.7 -5.66%
benchmark old MB/s new MB/s speedup
BenchmarkReadSlice1000Int32s 285.58 283.24 0.99x
BenchmarkReadStruct 27.90 28.60 1.03x
BenchmarkReadInts 32.57 32.31 0.99x
BenchmarkWriteInts 14.38 14.41 1.00x
BenchmarkWriteSlice1000Int32s 297.60 296.36 1.00x
BenchmarkPutUvarint32 140.55 151.92 1.08x
BenchmarkPutUvarint64 98.36 104.33 1.06x
Fixes #6818.
LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/149290045
|
|
Fixes #7306.
LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/153820044
|
|
Preparation was in CL 134570043.
This CL contains only the effect of 'hg mv src/pkg/* src'.
For more about the move, see golang.org/s/go14nopkg.
|