- 14 Aug, 2017 33 commits
-
-
Martin Möhrmann authored
Applies the optimizations from golang.org/cl/42810 and golang.org/cl/37959 done to the strings package to the bytes package. name old time/op new time/op delta Fields/ASCII/16 417ns ± 4% 118ns ± 3% -71.65% (p=0.000 n=10+10) Fields/ASCII/256 5.95µs ± 3% 0.88µs ± 0% -85.23% (p=0.000 n=10+7) Fields/ASCII/4096 92.3µs ± 1% 12.8µs ± 2% -86.13% (p=0.000 n=10+10) Fields/ASCII/65536 1.49ms ± 1% 0.25ms ± 1% -83.14% (p=0.000 n=10+10) Fields/ASCII/1048576 25.0ms ± 1% 6.5ms ± 2% -74.04% (p=0.000 n=10+10) Fields/Mixed/16 406ns ± 1% 222ns ± 1% -45.24% (p=0.000 n=10+9) Fields/Mixed/256 5.78µs ± 1% 2.27µs ± 1% -60.73% (p=0.000 n=9+10) Fields/Mixed/4096 97.9µs ± 1% 40.5µs ± 3% -58.66% (p=0.000 n=10+10) Fields/Mixed/65536 1.58ms ± 1% 0.69ms ± 1% -56.58% (p=0.000 n=10+10) Fields/Mixed/1048576 26.6ms ± 1% 12.6ms ± 2% -52.44% (p=0.000 n=9+10) FieldsFunc/ASCII/16 395ns ± 1% 188ns ± 1% -52.34% (p=0.000 n=10+10) FieldsFunc/ASCII/256 5.90µs ± 1% 2.00µs ± 1% -66.06% (p=0.000 n=10+10) FieldsFunc/ASCII/4096 92.5µs ± 1% 33.0µs ± 1% -64.34% (p=0.000 n=10+9) FieldsFunc/ASCII/65536 1.48ms ± 1% 0.54ms ± 1% -63.38% (p=0.000 n=10+9) FieldsFunc/ASCII/1048576 25.1ms ± 1% 10.5ms ± 3% -58.24% (p=0.000 n=10+10) FieldsFunc/Mixed/16 401ns ± 1% 205ns ± 2% -48.87% (p=0.000 n=10+10) FieldsFunc/Mixed/256 5.70µs ± 1% 1.98µs ± 1% -65.28% (p=0.000 n=10+10) FieldsFunc/Mixed/4096 97.5µs ± 1% 35.4µs ± 1% -63.65% (p=0.000 n=10+10) FieldsFunc/Mixed/65536 1.57ms ± 1% 0.61ms ± 1% -61.20% (p=0.000 n=10+10) FieldsFunc/Mixed/1048576 26.5ms ± 1% 11.4ms ± 2% -56.84% (p=0.000 n=10+10) name old speed new speed delta Fields/ASCII/16 38.4MB/s ± 4% 134.9MB/s ± 3% +251.55% (p=0.000 n=10+10) Fields/ASCII/256 43.0MB/s ± 3% 290.6MB/s ± 1% +575.97% (p=0.000 n=10+8) Fields/ASCII/4096 44.4MB/s ± 1% 320.0MB/s ± 2% +620.90% (p=0.000 n=10+10) Fields/ASCII/65536 44.0MB/s ± 1% 260.7MB/s ± 1% +493.15% (p=0.000 n=10+10) Fields/ASCII/1048576 42.0MB/s ± 1% 161.6MB/s ± 2% +285.21% (p=0.000 n=10+10) Fields/Mixed/16 39.4MB/s ± 1% 71.7MB/s ± 1% +82.20% (p=0.000 n=10+10) Fields/Mixed/256 44.3MB/s ± 1% 112.8MB/s ± 1% +154.64% (p=0.000 n=9+10) Fields/Mixed/4096 41.9MB/s ± 1% 101.2MB/s ± 3% +141.92% (p=0.000 n=10+10) Fields/Mixed/65536 41.5MB/s ± 1% 95.5MB/s ± 1% +130.29% (p=0.000 n=10+10) Fields/Mixed/1048576 39.4MB/s ± 1% 82.9MB/s ± 2% +110.28% (p=0.000 n=9+10) FieldsFunc/ASCII/16 40.5MB/s ± 1% 84.9MB/s ± 2% +109.80% (p=0.000 n=10+10) FieldsFunc/ASCII/256 43.4MB/s ± 1% 127.9MB/s ± 1% +194.58% (p=0.000 n=10+10) FieldsFunc/ASCII/4096 44.3MB/s ± 1% 124.2MB/s ± 1% +180.44% (p=0.000 n=10+9) FieldsFunc/ASCII/65536 44.2MB/s ± 1% 120.6MB/s ± 1% +173.06% (p=0.000 n=10+9) FieldsFunc/ASCII/1048576 41.8MB/s ± 1% 100.2MB/s ± 3% +139.53% (p=0.000 n=10+10) FieldsFunc/Mixed/16 39.8MB/s ± 1% 77.8MB/s ± 2% +95.46% (p=0.000 n=10+10) FieldsFunc/Mixed/256 44.9MB/s ± 1% 129.4MB/s ± 1% +187.97% (p=0.000 n=10+10) FieldsFunc/Mixed/4096 42.0MB/s ± 1% 115.6MB/s ± 1% +175.08% (p=0.000 n=10+10) FieldsFunc/Mixed/65536 41.6MB/s ± 1% 107.3MB/s ± 1% +157.75% (p=0.000 n=10+10) FieldsFunc/Mixed/1048576 39.6MB/s ± 1% 91.8MB/s ± 2% +131.72% (p=0.000 n=10+10) name old alloc/op new alloc/op delta Fields/ASCII/16 80.0B ± 0% 80.0B ± 0% ~ (all equal) Fields/ASCII/256 768B ± 0% 768B ± 0% ~ (all equal) Fields/ASCII/4096 9.47kB ± 0% 9.47kB ± 0% ~ (all equal) Fields/ASCII/65536 147kB ± 0% 147kB ± 0% ~ (all equal) Fields/ASCII/1048576 2.27MB ± 0% 2.27MB ± 0% ~ (all equal) Fields/Mixed/16 96.0B ± 0% 96.0B ± 0% ~ (all equal) Fields/Mixed/256 768B ± 0% 768B ± 0% ~ (all equal) Fields/Mixed/4096 9.47kB ± 0% 24.83kB ± 0% +162.16% (p=0.000 n=10+10) Fields/Mixed/65536 147kB ± 0% 497kB ± 0% +237.24% (p=0.000 n=10+10) Fields/Mixed/1048576 2.26MB ± 0% 9.61MB ± 0% +324.89% (p=0.000 n=10+10) FieldsFunc/ASCII/16 80.0B ± 0% 80.0B ± 0% ~ (all equal) FieldsFunc/ASCII/256 768B ± 0% 768B ± 0% ~ (all equal) FieldsFunc/ASCII/4096 9.47kB ± 0% 24.83kB ± 0% +162.16% (p=0.000 n=10+10) FieldsFunc/ASCII/65536 147kB ± 0% 497kB ± 0% +237.24% (p=0.000 n=10+10) FieldsFunc/ASCII/1048576 2.27MB ± 0% 9.61MB ± 0% +323.72% (p=0.000 n=10+10) FieldsFunc/Mixed/16 96.0B ± 0% 96.0B ± 0% ~ (all equal) FieldsFunc/Mixed/256 768B ± 0% 768B ± 0% ~ (all equal) FieldsFunc/Mixed/4096 9.47kB ± 0% 24.83kB ± 0% +162.16% (p=0.000 n=10+10) FieldsFunc/Mixed/65536 147kB ± 0% 497kB ± 0% +237.24% (p=0.000 n=10+10) FieldsFunc/Mixed/1048576 2.26MB ± 0% 9.61MB ± 0% +324.89% (p=0.000 n=10+10) name old allocs/op new allocs/op delta Fields/ASCII/16 1.00 ± 0% 1.00 ± 0% ~ (all equal) Fields/ASCII/256 1.00 ± 0% 1.00 ± 0% ~ (all equal) Fields/ASCII/4096 1.00 ± 0% 1.00 ± 0% ~ (all equal) Fields/ASCII/65536 1.00 ± 0% 1.00 ± 0% ~ (all equal) Fields/ASCII/1048576 1.00 ± 0% 1.00 ± 0% ~ (all equal) Fields/Mixed/16 1.00 ± 0% 1.00 ± 0% ~ (all equal) Fields/Mixed/256 1.00 ± 0% 1.00 ± 0% ~ (all equal) Fields/Mixed/4096 1.00 ± 0% 5.00 ± 0% +400.00% (p=0.000 n=10+10) Fields/Mixed/65536 1.00 ± 0% 12.00 ± 0% +1100.00% (p=0.000 n=10+10) Fields/Mixed/1048576 1.00 ± 0% 24.00 ± 0% +2300.00% (p=0.000 n=10+10) FieldsFunc/ASCII/16 1.00 ± 0% 1.00 ± 0% ~ (all equal) FieldsFunc/ASCII/256 1.00 ± 0% 1.00 ± 0% ~ (all equal) FieldsFunc/ASCII/4096 1.00 ± 0% 5.00 ± 0% +400.00% (p=0.000 n=10+10) FieldsFunc/ASCII/65536 1.00 ± 0% 12.00 ± 0% +1100.00% (p=0.000 n=10+10) FieldsFunc/ASCII/1048576 1.00 ± 0% 24.00 ± 0% +2300.00% (p=0.000 n=10+10) FieldsFunc/Mixed/16 1.00 ± 0% 1.00 ± 0% ~ (all equal) FieldsFunc/Mixed/256 1.00 ± 0% 1.00 ± 0% ~ (all equal) FieldsFunc/Mixed/4096 1.00 ± 0% 5.00 ± 0% +400.00% (p=0.000 n=10+10) FieldsFunc/Mixed/65536 1.00 ± 0% 12.00 ± 0% +1100.00% (p=0.000 n=10+10) FieldsFunc/Mixed/1048576 1.00 ± 0% 24.00 ± 0% +2300.00% (p=0.000 n=10+10) Change-Id: If1926782decc2f60d3b4b8c41c2ce7d8bdedfd8f Reviewed-on: https://go-review.googlesource.com/55131 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
-
Martin Möhrmann authored
Remove goto and use helper functions in ParseUint to create errors. Change-Id: I1c4677ae1b9980db79065a9f8ca1f2c470249505 Reviewed-on: https://go-review.googlesource.com/55135 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
-
Martin Möhrmann authored
Instead of printing Atoi as function name for test failures print the actual function name and arguments tested. Add a base field to the parseUint64BaseTests for consistency with the parseInt64BaseTests tests. Change-Id: Ib9891bdb87b62672b4216625212acfe6474c70fc Reviewed-on: https://go-review.googlesource.com/55136 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
-
Keith Randall authored
This makes sure that its argument is marked live on entry. We need its arg to be live so defers of KeepAlive get scanned correctly by the GC. Fixes #21402 Change-Id: I906813e433d0e9726ca46483723303338da5b4d7 Reviewed-on: https://go-review.googlesource.com/55150 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Dmitry Vyukov authored
Currently go fmt formats all files sequentially. That's a shame. Parallelize it over files. Reduces time of go fmt ./... in std lib from ~6.1s to ~0.9s. Reduces time of go fmt github.com/google/syzkaller/... from ~5.2s to ~1.8s. Change-Id: I3d27fc25326106b2a4781e13506a25c12d5bcdc5 Reviewed-on: https://go-review.googlesource.com/45491 Run-TryBot: Dmitry Vyukov <dvyukov@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Ilya Tocar authored
Unroll loop to improve perfromance back to 1.8 level. name old time/op new time/op delta EncodeToString-6 63.0µs ± 3% 51.7µs ± 2% -17.94% (p=0.000 n=10+10) name old speed new speed delta EncodeToString-6 130MB/s ± 3% 159MB/s ± 2% +21.83% (p=0.000 n=10+10) Vs 1.8: EncodeToString-6 54.9µs ± 2% 51.7µs ± 2% -5.95% (p=0.000 n=10+10) name old speed new speed delta EncodeToString-6 149MB/s ± 2% 159MB/s ± 2% +6.32% (p=0.000 n=10+10) Fixes #21262 Change-Id: I41bf7e1f61041781386d16d573bffe1a7173c0c3 Reviewed-on: https://go-review.googlesource.com/52510 Run-TryBot: Ilya Tocar <ilya.tocar@intel.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
-
Hiroshi Ioka authored
Also, unexport Machoadddynlib n=`go test -c crypto/x509 && otool -l x509.test | grep libSystem | wc -l` Before this CL, n = 3. After this CL, n = 1. on my environment. Change-Id: Ic7b8157435cc85086404860dc6c84eb0aecc5d19 Reviewed-on: https://go-review.googlesource.com/44771Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Avelino <t@avelino.xxx> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Hiroshi Ioka authored
Fixes #21435 Change-Id: I5f8d93a45b84a871ceea881ecb1a38a37e96006c Reviewed-on: https://go-review.googlesource.com/55263Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Hiroshi Ioka authored
Change some configurations to enable the feature. Also add the test. This CL doesn't include internal linking support which is tentatively disabled due to #18968. We could do that another day. Fixes #21220 Change-Id: I601d2d78446d36332acc70be0d5b9461ac635208 Reviewed-on: https://go-review.googlesource.com/54790Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Justin Nuß authored
The parser mistakenly assumed it could always fold \r\n into \n, which is not true since a \r\n inside a quoted fields has no special meaning and should be kept as is. Fix this by not folding \r\n to \n inside quotes fields. Fixes #21201 Change-Id: Ifebc302e49cf63e0a027ee90f088dbc050a2b7a6 Reviewed-on: https://go-review.googlesource.com/52810Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Daniel Martí authored
* Remove an unnecessary type conversion * Make golint happier about consistent receiver names * Make golint happier about a foo_bar var name Change-Id: I5223808109f6f8b69ed4be76de82faf2478c6a2e Reviewed-on: https://go-review.googlesource.com/54530 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Tom Bergan <tombergan@google.com>
-
Alberto Donizetti authored
Change-Id: Iffb52a0bdc479642eda3b5a12ba5da6590d0f0ec Reviewed-on: https://go-review.googlesource.com/55330Reviewed-by: Robert Griesemer <gri@golang.org>
-
griesemer authored
The old comment for the example type PtrMutex *Mutex talked about the method set of the base type of PtrMutex. It's more direct and clearer to talk about the underlying type of PtrMutex for this specific example. Also removed link inside pre-formatted region of text. Fixes #20900. Change-Id: Ie37340e53670e34ebe13e780ba8ccb1bba67795c Reviewed-on: https://go-review.googlesource.com/55070Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Martin Möhrmann authored
name old time/op new time/op delta SprintfSlowParsingPath 108ns ± 4% 103ns ± 4% -4.53% (p=0.000 n=18+18) Change-Id: I174463f303d1857e8d5b8a6283c025b3546e7b39 Reviewed-on: https://go-review.googlesource.com/44450 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
-
Carlos Eduardo Seo authored
This change replaces the current runtime capabilities check for ppc64x with the new internal/cpu package. It also adds support for the new POWER9 ISA and capabilities. Updates #15403 Change-Id: I5b64a79e782f8da3603e5529600434f602986292 Reviewed-on: https://go-review.googlesource.com/53830Reviewed-by: Martin Möhrmann <moehrmann@google.com>
-
Joe Tsai authored
Since test files don't exceed 10KiB, print the full context of the diff, including bytes that are equal. Also, fix the labels for got and want; they were backwards before. Change-Id: Ibac022e5f988d26812c3f75b643cae8b95603fc9 Reviewed-on: https://go-review.googlesource.com/55151Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org>
-
Joe Tsai authored
Rather than going through writeHeader, which attempts to handle all formats, implement writePAXHeader, which only has an understanding of the PAX format. In PAX, the USTAR header is filled out in a best-effort manner. Thus, we change logic of formatString and formatOctal to try their best to output something (possibly truncated) in the event of an error. The new implementation of PAX headers causes several tests to fail. An investigation into the new output reveals that the new behavior is correct, while the tests had actually locked in incorrect behavior before. A dump of the differences is listed below (-before, +after): << writer-big.tar >> This change is due to fact that we changed the Header.Devminor to force the tar.Writer to choose the GNU format over the PAX one. The ability to control the output is an open issue (see #18710). - 00000150 00 30 30 30 30 30 30 30 00 00 00 00 00 00 00 00 |.0000000........| + 00000150 00 ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 |................| << writer-big-long.tar>> The previous logic generated the GNU magic values for a PAX file. The new logic correctly uses the USTAR magic values. - 00000100 00 75 73 74 61 72 20 20 00 00 00 00 00 00 00 00 |.ustar ........| - 00000500 00 75 73 74 61 72 20 20 00 67 75 69 6c 6c 61 75 |.ustar .guillau| + 00000100 00 75 73 74 61 72 00 30 30 00 00 00 00 00 00 00 |.ustar.00.......| + 00000500 00 75 73 74 61 72 00 30 30 67 75 69 6c 6c 61 75 |.ustar.00guillau| The previous logic tried to use the specified timestmap in the PAX headers file, but this is problematic as this timestamp can overflow, defeating the point of using PAX, which is intended to extend tar. The new logic uses the zero timestamp similar to what GNU and BSD tar do. - 00000080 30 30 30 30 32 33 32 00 31 32 33 33 32 37 37 30 |0000232.12332770| + 00000080 30 30 30 30 32 35 36 00 30 30 30 30 30 30 30 30 |0000256.00000000| The previous logic populated the devminor and devmajor fields. The new logic leaves them zeroed just like what GNU and BSD tar do. - 00000140 00 00 00 00 00 00 00 00 00 30 30 30 30 30 30 30 |.........0000000| - 00000150 00 30 30 30 30 30 30 30 00 00 00 00 00 00 00 00 |.0000000........| + 00000140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| + 00000150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| The previous logic uses PAX headers, but fails to add a record for the size. The new logic does properly add a record for the size. - 00000290 31 36 67 69 67 2e 74 78 74 0a 00 00 00 00 00 00 |16gig.txt.......| - 000002a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| + 00000290 31 36 67 69 67 2e 74 78 74 0a 32 30 20 73 69 7a |16gig.txt.20 siz| + 000002a0 65 3d 31 37 31 37 39 38 36 39 31 38 34 0a 00 00 |e=17179869184...| The previous logic encoded the size as a base-256 field, which is only valid in GNU, but the previous PAX headers implies this should be a PAX file. This result in a strange hybrid that is neither GNU nor PAX. The new logic uses PAX headers to store the size. - 00000470 37 35 30 00 30 30 30 31 37 35 30 00 80 00 00 00 |750.0001750.....| - 00000480 00 00 00 04 00 00 00 00 31 32 33 33 32 37 37 30 |........12332770| + 00000470 37 35 30 00 30 30 30 31 37 35 30 00 30 30 30 30 |750.0001750.0000| + 00000480 30 30 30 30 30 30 30 00 31 32 33 33 32 37 37 30 |0000000.12332770| << ustar.issue12594.tar >> The previous logic used the specified timestamp for the PAX headers file. The new logic just uses the zero timestmap. - 00000080 30 30 30 30 32 33 31 00 31 32 31 30 34 34 30 32 |0000231.12104402| + 00000080 30 30 30 30 32 33 31 00 30 30 30 30 30 30 30 30 |0000231.00000000| The previous logic populated the devminor and devmajor fields. The new logic leaves them zeroed just like what GNU and BSD tar do. - 00000140 00 00 00 00 00 00 00 00 00 30 30 30 30 30 30 30 |.........0000000| - 00000150 00 30 30 30 30 30 30 30 00 00 00 00 00 00 00 00 |.0000000........| + 00000140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| + 00000150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| Change-Id: I33419eb1124951968e9d5a10d50027e03133c811 Reviewed-on: https://go-review.googlesource.com/55231Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Hiroshi Ioka authored
Just like https://golang.org/cl/34783 Given cgo.go: 1 package main 2 3 /* 4 long double x = 0; 5 */ 6 import "C" 7 8 func main() { 9 _ = C.x 10 _ = C.x 11 } Before: ./cgo.go:10:6: unexpected: 16-byte float type - long double After: ./cgo.go:9:6: unexpected: 16-byte float type - long double The above test case is not portable. So it is tested on only amd64. Change-Id: If0b84cf73d381a22e2ada71c8e9a6e6ec77ffd2e Reviewed-on: https://go-review.googlesource.com/54950Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Hiroshi Ioka authored
We might want to replace some linker's feature by debug/macho in future. This CL gathers information of required constants. Change-Id: Iea14abdb32709a4f5404a17874f9c925d29ba999 Reviewed-on: https://go-review.googlesource.com/55252Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Hiroshi Ioka authored
Also, fix comment. Change-Id: Ieb7ba21f34730dc51ab45a652d225e4145d4b861 Reviewed-on: https://go-review.googlesource.com/54870 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Hiroshi Ioka authored
Fixes #21414 Change-Id: Idff6e269ae32b33253067c9f32cac25256eb7f1c Reviewed-on: https://go-review.googlesource.com/55251Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Agniva De Sarker authored
The tests for error scenarios were done by manually checking error strings. Improved them by checking the actual error type instead of just the string. Printing the actual error in case of failure instead of a generic string. Also added a new scenario with both an invalid byte and an invalid length string to verify that the length is checked first before doing any computation. Change-Id: Ic2a19a6d6058912632d597590186ee2d8348cb45 Reviewed-on: https://go-review.googlesource.com/55256Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Justin Nuß authored
Errors returned by Reader contain the line where the Reader originally encountered the error. This can be suboptimal since that line does not always correspond with the line the current record/field started at. This can easily happen with LazyQuotes as seen in #19019, but also happens for example when a quoted fields has no closing quote and the parser hits EOF before it finds another quote. When this happens finding the erroneous field can be somewhat complicated and time consuming, and in most cases it would be better to report the line where the record started. This change updates Reader to keep track of the line on which a record begins and uses it for errors instead of the current line, making it easier to find errors. Although a user-visible change, this should have no impact on existing code, since most users don't explicitly work with the line in the error and probably already expect the new behaviour. Updates #19019 Change-Id: Ic9bc70fad2651c69435d614d537e7a9266819b05 Reviewed-on: https://go-review.googlesource.com/52830Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Hiroshi Ioka authored
Change-Id: I5c4f8dc1e174b3438ef4fb509fac78d6e1b292c9 Reviewed-on: https://go-review.googlesource.com/54791Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Avelino <t@avelino.xxx> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Rob Pike authored
No semantic change, just clarifying a bit by choosing better words in a couple of places. Change-Id: I4496062ee7909baf83d4d22d25e13ef93b358b4b Reviewed-on: https://go-review.googlesource.com/55255Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Tobias Klauser authored
All the BSDs and Solaris support the utimensat syscall, but Darwin doesn't. Account for that by adding the //sys lines not to syscall_bsd.go but the individual OS's syscall_*.go files and implement utimensat on Darwin as just returning ENOSYS, such that UtimesNano will fall back to use utimes as it currently does unconditionally. This also adds the previously missing utimensat syscall number for FreeBSD and Dragonfly. Fixes #16480 Change-Id: I367454c6168eb1f7150b988fa16cf02abff42f34 Reviewed-on: https://go-review.googlesource.com/55130Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org>
-
Kevin Burke authored
lookupName is only called in one location, and one of the return values is unused, so let's remove it. Change-Id: I35e22c7ec611e8eb349deb4f0561e212f7d9de0b Reviewed-on: https://go-review.googlesource.com/55232Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Rob Pike <r@golang.org> Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
-
Austin Clements authored
This reverts commit f612cd70. Reason for revert: We thought the original change had broken the linux/amd64 and linux/386 builders, but it turned out to be a problem with the build infrastructure, not the change. Change-Id: Ic3318a63464fcba8d845ac04494115a7ba620364 Reviewed-on: https://go-review.googlesource.com/55050 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
-
Josh Bleecher Snyder authored
Invert the condition and continue, to remove indentation. Change-Id: Id62a5d9abc9a4df1193bcf15f95f70f2c2e2abac Reviewed-on: https://go-review.googlesource.com/55091 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Martin Möhrmann <moehrmann@google.com>
-
Josh Bleecher Snyder authored
This generates better code. Masking B in the return statement should be unnecessary, but the compiler is understandably not yet clever enough to see that. Someday, it'd also be nice for the compiler to generate a CMOV for the saturation if statement. Change-Id: Ie1c157b21f5212610da1f3c7823a93816b3b61b9 Reviewed-on: https://go-review.googlesource.com/54656 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Martin Möhrmann <moehrmann@google.com>
-
Josh Bleecher Snyder authored
Shrinks evacuate's machine code a little. Change-Id: I08874c92abdc7e621bc0737e22f2a6be31542cab Reviewed-on: https://go-review.googlesource.com/54652 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Martin Möhrmann <moehrmann@google.com>
-
Josh Bleecher Snyder authored
Combine conditions into a single if statement. This is more readable. It should generate identical machine code, but it doesn't. The new code is shorter. Change-Id: I9bf52f8f288b0df97a2b9b4e4183f6ca74175e8a Reviewed-on: https://go-review.googlesource.com/54651 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Martin Möhrmann <moehrmann@google.com>
-
Josh Bleecher Snyder authored
This reduces the wall time to run these benchmarks by about 30%. Change-Id: I494a93c93e5acb1514510d85f65796f62e1629a5 Reviewed-on: https://go-review.googlesource.com/54650 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Martin Möhrmann <moehrmann@google.com>
-
- 13 Aug, 2017 6 commits
-
-
Austin Clements authored
Currently we only support finding symbols in the VDSO using the old DT_HASH. These days everything uses DT_GNU_HASH instead. To keep up with the times and future-proof against DT_HASH disappearing from the VDSO in the future, this commit adds support for DT_GNU_HASH and prefers it over DT_HASH. Tested by making sure it found a DT_GNU_HASH section and all of the expected symbols in it, and then disabling the DT_GNU_HASH path and making sure the old DT_HASH path still found all of the symbols. Fixes #19649. Change-Id: I508c8b35a019330d2c32f04f3833b69cb2686f13 Reviewed-on: https://go-review.googlesource.com/45511 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Audrey Lim authored
The ZIP format uses uint16 to contain the length of the file name and the length of the Extra section. This change verifies that the length of these fields fit in an uint16 prior to writing the ZIP file. If not, an error is returned. Fixes #17402 Change-Id: Ief9a864d2fe16b89ddb9917838283b801a2c58a4 Reviewed-on: https://go-review.googlesource.com/50250Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com> Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Martin Möhrmann authored
If needed cast the test table values to a higher bit size integer type instead of casting the result values of the tested function to a lower bit size integer type. Change-Id: Iaa79742b2b1d90c7c7eac324f54032ebea0b1b41 Reviewed-on: https://go-review.googlesource.com/55137Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
-
Martin Möhrmann authored
Increases performance of FieldsFunc by recording the start and end of the fields in an array. The first 32 fields are saved in a pre-allocated array on the stack. This avoids the old behavior of iterating over the input string two times but uses more allocations when more than 32 fields are encountered. Additionally code for handling non-ASCII containing strings from Fields is removed and replaced by a call to the new faster FieldsFunc function. Overall this still leads to a slowdown for Fields on non-ASCII strings while speeding up Fields in general. name old time/op new time/op delta Fields/ASCII/16 116ns ± 5% 115ns ± 5% ~ (p=0.480 n=10+10) Fields/ASCII/256 765ns ± 1% 761ns ± 2% ~ (p=0.171 n=10+10) Fields/ASCII/4096 12.5µs ± 1% 12.7µs ± 1% +1.82% (p=0.000 n=10+10) Fields/ASCII/65536 226µs ± 1% 226µs ± 2% ~ (p=0.739 n=10+10) Fields/ASCII/1048576 5.12ms ± 1% 5.12ms ± 1% ~ (p=0.696 n=8+10) Fields/Mixed/16 172ns ± 1% 233ns ± 1% +35.90% (p=0.000 n=9+10) Fields/Mixed/256 1.18µs ± 2% 2.45µs ± 1% +107.47% (p=0.000 n=10+10) Fields/Mixed/4096 20.3µs ± 1% 43.1µs ± 2% +112.41% (p=0.000 n=10+10) Fields/Mixed/65536 364µs ± 1% 704µs ± 1% +93.56% (p=0.000 n=9+10) Fields/Mixed/1048576 7.07ms ± 2% 13.34ms ± 4% +88.83% (p=0.000 n=10+10) FieldsFunc/ASCII/16 274ns ± 1% 188ns ± 3% -31.44% (p=0.000 n=10+10) FieldsFunc/ASCII/256 3.69µs ± 1% 2.06µs ± 2% -44.26% (p=0.000 n=10+10) FieldsFunc/ASCII/4096 59.9µs ± 1% 35.3µs ± 2% -41.10% (p=0.000 n=10+10) FieldsFunc/ASCII/65536 958µs ± 1% 567µs ± 1% -40.82% (p=0.000 n=10+9) FieldsFunc/ASCII/1048576 16.3ms ± 2% 11.0ms ± 3% -32.52% (p=0.000 n=10+10) FieldsFunc/Mixed/16 309ns ± 1% 213ns ± 0% -30.98% (p=0.000 n=10+6) FieldsFunc/Mixed/256 3.83µs ± 1% 2.14µs ± 1% -44.01% (p=0.000 n=10+10) FieldsFunc/Mixed/4096 66.2µs ± 2% 37.8µs ± 1% -42.85% (p=0.000 n=10+10) FieldsFunc/Mixed/65536 1.09ms ± 1% 0.63ms ± 1% -42.73% (p=0.000 n=10+10) FieldsFunc/Mixed/1048576 18.6ms ± 3% 12.0ms ± 2% -35.50% (p=0.000 n=10+10) Fixes #17856 Fixes #19789 Change-Id: I9f5a560e534566fd81963651f342c8f44cfb0469 Reviewed-on: https://go-review.googlesource.com/42810Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
-
Martin Möhrmann authored
If the value corresponding to the input string cannot be represented by an unsigned integer of the given size, err.Err = ErrRange and the returned value is the maximum magnitude unsigned integer of the appropriate bitSize. This is consistent with ParseInt's behavior and the documentation. Expand tests to test 32 bit test value tables with bitsize 32 set. These tests fail without the fix in this CL. Fixes #21278 Change-Id: I8aab39279ec3e31905fcbf582a916cbf6d9b95da Reviewed-on: https://go-review.googlesource.com/55134 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
-
Joe Tsai authored
Use a simple []byte instead of bytes.Buffer to create a string. Use bytes.IndexByte instead of our own for loop. Change-Id: Ic4a1161d79017fd3af086a05c53d5f20a5f09326 Reviewed-on: https://go-review.googlesource.com/54752Reviewed-by: Avelino <t@avelino.xxx> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
-
- 12 Aug, 2017 1 commit
-
-
Agniva De Sarker authored
By replacing fmt.Sprintf with a simple string concat, we see pretty good improvements across the board on time and memory. name old time/op new time/op delta FormatPAXRecord 683ns ± 2% 210ns ± 5% -69.22% (p=0.000 n=10+10) name old alloc/op new alloc/op delta FormatPAXRecord 112B ± 0% 32B ± 0% -71.43% (p=0.000 n=10+10) name old allocs/op new allocs/op delta FormatPAXRecord 8.00 ± 0% 2.00 ± 0% -75.00% (p=0.000 n=10+10) Ran with - -cpu=1 -count=10 on an AMD64 i5-5200U CPU @ 2.20GHz Using the following benchmark: func BenchmarkFormatPAXRecord(b *testing.B) { for n := 0; n < b.N; n++ { formatPAXRecord("foo", "bar") } } Change-Id: I828ddbafad2e5d937f0cf5f777b512638344acfc Reviewed-on: https://go-review.googlesource.com/55210Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
-