]> Cypherpunks repositories - gostls13.git/log
gostls13.git
10 years agoruntime/cgo: revert use of undefined logging function
David Crawshaw [Thu, 3 Jul 2014 20:52:34 +0000 (16:52 -0400)]
runtime/cgo: revert use of undefined logging function

It snuck into cl/106380043. Too many active clients.

LGTM=ruiu
R=golang-codereviews, ruiu
CC=golang-codereviews
https://golang.org/cl/110830045

10 years agocmd/go, cmd/ld, runtime, os/user: TLS emulation for android
David Crawshaw [Thu, 3 Jul 2014 20:14:34 +0000 (16:14 -0400)]
cmd/go, cmd/ld, runtime, os/user: TLS emulation for android

Based on cl/69170045 by Elias Naur.

There are currently several schemes for acquiring a TLS
slot to save the g register. None of them appear to work
for android. The closest are linux and darwin.

Linux uses a linker TLS relocation. This is not supported
by the android linker.

Darwin uses a fixed offset, and calls pthread_key_create
until it gets the slot it wants. As the runtime loads
late in the android process lifecycle, after an
arbitrary number of other libraries, we cannot rely on
any particular slot being available.

So we call pthread_key_create, take the first slot we are
given, and put it in runtime.tlsg, which we turn into a
regular variable in cmd/ld.

Makes android/arm cgo binaries work.

LGTM=minux
R=elias.naur, minux, dave, josharian
CC=golang-codereviews
https://golang.org/cl/106380043

10 years agoruntime: delete unnecessary confusing code
Dmitriy Vyukov [Thu, 3 Jul 2014 18:58:42 +0000 (22:58 +0400)]
runtime: delete unnecessary confusing code
The code in GC that handles gp->gobuf.ctxt is wrong,
because it does not mark the ctxt object itself,
if just queues the ctxt object for scanning.
So the ctxt object can be collected as garbage.
However, Gobuf.ctxt is void*, so it's always marked and
scanned through G.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, khr, rsc
https://golang.org/cl/105490044

10 years agocrypto/x509: fix format strings in test
Dmitriy Vyukov [Thu, 3 Jul 2014 08:08:24 +0000 (12:08 +0400)]
crypto/x509: fix format strings in test
Currently it says:
--- PASS: TestDecrypt-2 (0.11s)
pem_decrypt_test.go:17: test 0. %!s(x509.PEMCipher=1)
--- PASS: TestEncrypt-2 (0.00s)
pem_decrypt_test.go:42: test 0. %!s(x509.PEMCipher=1)

LGTM=alex.brainman
R=golang-codereviews, alex.brainman
CC=golang-codereviews
https://golang.org/cl/108400044

10 years agoruntime: make runtime·usleep and runtime·osyield callable from cgo callback
Aram Hăvărneanu [Thu, 3 Jul 2014 01:36:05 +0000 (11:36 +1000)]
runtime: make runtime·usleep and runtime·osyield callable from cgo callback

runtime·usleep and runtime·osyield fall back to calling an
assembly wrapper for the libc functions in the absence of a m,
so they can be called in cgo callback context.

LGTM=rsc
R=minux.ma, rsc
CC=dave, golang-codereviews
https://golang.org/cl/102620044

10 years agoarchive/tar: reuse temporary buffer in readHeader
Cristian Staretu [Wed, 2 Jul 2014 23:41:19 +0000 (09:41 +1000)]
archive/tar: reuse temporary buffer in readHeader

A temporary 512 bytes buffer is allocated for every call to
readHeader. This buffer isn't returned to the caller and it could
be reused to lower the number of memory allocations.

This CL improves it by using a pool and zeroing out the buffer before
putting it back into the pool.

benchmark                  old ns/op     new ns/op     delta
BenchmarkListFiles100k     545249903     538832687     -1.18%

benchmark                  old allocs    new allocs    delta
BenchmarkListFiles100k     2105167       2005692       -4.73%

benchmark                  old bytes     new bytes     delta
BenchmarkListFiles100k     105903472     54831527      -48.22%

This improvement is very important if your code has to deal with a lot
of tarballs which contain a lot of files.

LGTM=dsymonds
R=golang-codereviews, dave, dsymonds, bradfitz
CC=golang-codereviews
https://golang.org/cl/108240044

10 years agoarchive/tar: reuse temporary buffer in writeHeader
Cristian Staretu [Wed, 2 Jul 2014 23:40:53 +0000 (09:40 +1000)]
archive/tar: reuse temporary buffer in writeHeader

A temporary 512 bytes buffer is allocated for every call to
writeHeader. This buffer could be reused the lower the number
of memory allocations.

benchmark                   old ns/op     new ns/op     delta
BenchmarkWriteFiles100k     634622051     583810847     -8.01%

benchmark                   old allocs     new allocs     delta
BenchmarkWriteFiles100k     2701920        2602621        -3.68%

benchmark                   old bytes     new bytes     delta
BenchmarkWriteFiles100k     115383884     64349922      -44.23%

This change is very important if your code has to write a lot of
tarballs with a lot of files.

LGTM=dsymonds
R=golang-codereviews, dave, dsymonds
CC=golang-codereviews
https://golang.org/cl/107440043

10 years agocrypto/rsa: fix out-of-bound access with short session keys.
Adam Langley [Wed, 2 Jul 2014 22:28:57 +0000 (15:28 -0700)]
crypto/rsa: fix out-of-bound access with short session keys.

Thanks to Cedric Staub for noting that a short session key would lead
to an out-of-bounds access when conditionally copying the too short
buffer over the random session key.

LGTM=davidben, bradfitz
R=davidben, bradfitz
CC=golang-codereviews
https://golang.org/cl/102670044

10 years agobuild: annotations and modifications for c2go
Russ Cox [Wed, 2 Jul 2014 19:41:29 +0000 (15:41 -0400)]
build: annotations and modifications for c2go

The main changes fall into a few patterns:

1. Replace #define with enum.

2. Add /*c2go */ comment giving effect of #define.
This is necessary for function-like #defines and
non-enum-able #defined constants.
(Not all compilers handle negative or large enums.)

3. Add extra braces in struct initializer.
(c2go does not implement the full rules.)

This is enough to let c2go typecheck the source tree.
There may be more changes once it is doing
other semantic analyses.

LGTM=minux, iant
R=minux, dave, iant
CC=golang-codereviews
https://golang.org/cl/106860045

10 years agocrypto/cipher: fix typo in example comment
Preetam Jinka [Wed, 2 Jul 2014 17:46:54 +0000 (10:46 -0700)]
crypto/cipher: fix typo in example comment

LGTM=josharian
R=golang-codereviews, josharian
CC=golang-codereviews
https://golang.org/cl/110330043

10 years agobufio: Fixed call to Fatal, should be Fatalf.
Timo Truyts [Wed, 2 Jul 2014 14:04:01 +0000 (07:04 -0700)]
bufio: Fixed call to Fatal, should be Fatalf.

LGTM=iant
R=golang-codereviews, iant, bradfitz
CC=golang-codereviews
https://golang.org/cl/107390044

10 years agoA+C: Timo Truyts (individual CLA)
Brad Fitzpatrick [Wed, 2 Jul 2014 13:45:57 +0000 (06:45 -0700)]
A+C: Timo Truyts (individual CLA)

Generated by a+c.

R=gobot
CC=golang-codereviews
https://golang.org/cl/111820043

10 years agoA+C: Cristian Staretu (individual CLA)
Brad Fitzpatrick [Wed, 2 Jul 2014 12:24:44 +0000 (05:24 -0700)]
A+C: Cristian Staretu (individual CLA)

Generated by a+c.

R=gobot
CC=golang-codereviews
https://golang.org/cl/107450043

10 years agoliblink, runtime: preliminary support for plan9/amd64
Aram Hăvărneanu [Wed, 2 Jul 2014 11:04:10 +0000 (21:04 +1000)]
liblink, runtime: preliminary support for plan9/amd64

A TLS slot is reserved by _rt0_.*_plan9 as an automatic and
its address (which is static on Plan 9) is saved in the
global _privates symbol. The startup linkage now is exactly
like that from Plan 9 libc, and the way we access g is
exactly as if we'd have used privalloc(2).

Aside from making the code more standard, this change
drastically simplifies it, both for 386 and for amd64, and
makes the Plan 9 code in liblink common for both 386 and
amd64.

The amd64 runtime code was cleared of nxm assumptions, and
now runs on the standard Plan 9 kernel.

Note handling fixes will follow in a separate CL.

LGTM=rsc
R=golang-codereviews, rsc, bradfitz, dave
CC=0intro, ality, golang-codereviews, jas, minux.ma, mischief
https://golang.org/cl/101510049

10 years agoruntime: properly restore registers in Solaris runtime·sigtramp
Aram Hăvărneanu [Tue, 1 Jul 2014 23:34:06 +0000 (09:34 +1000)]
runtime: properly restore registers in Solaris runtime·sigtramp

We restored registers correctly in the usual case where the thread
is a Go-managed thread and called runtime·sighandler, but we
failed to do so when runtime·sigtramp was called on a cgo-created
thread. In that case, runtime·sigtramp called runtime·badsignal,
a Go function, and did not restore registers after it returned

LGTM=rsc, dave
R=rsc, dave
CC=golang-codereviews, minux.ma
https://golang.org/cl/105280050

10 years agomisc/nacl, syscall: lazily initialize fs on nacl.
Shenghou Ma [Tue, 1 Jul 2014 22:24:43 +0000 (18:24 -0400)]
misc/nacl, syscall: lazily initialize fs on nacl.
On amd64, the real time is reduced from 176.76s to 140.26s.
On ARM, the real time is reduced from 921.61s to 726.30s.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/101580043

10 years agoall: add GOOS=android
David Crawshaw [Tue, 1 Jul 2014 21:21:50 +0000 (17:21 -0400)]
all: add GOOS=android

As android and linux have significant overlap, and
because build tags are a poor way to represent an
OS target, this CL introduces an exception into
go/build: linux is treated as a synonym for android
when matching files.

http://golang.org/s/go14android
https://groups.google.com/forum/#!topic/golang-dev/P1ATVp1mun0

LGTM=rsc, minux
R=golang-codereviews, mikioh.mikioh, dave, aram, minux, gobot, rsc, aram.h, elias.naur, iant
CC=golang-codereviews, rsc
https://golang.org/cl/105270043

10 years agoencoding/gob: fewer decAlloc calls
Russ Cox [Tue, 1 Jul 2014 18:19:27 +0000 (14:19 -0400)]
encoding/gob: fewer decAlloc calls

Move decAlloc calls a bit higher in the call tree.
Cleans code marginally, improves speed marginally.
The benchmarks are noisy but the median time from
20 consective 1-second runs improves by about 2%.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/105530043

10 years agocmd/gofmt: fix gofmt -s for 3-index slices
Robert Griesemer [Tue, 1 Jul 2014 17:40:27 +0000 (10:40 -0700)]
cmd/gofmt: fix gofmt -s for 3-index slices

3-index slices of the form s[:len(s):len(s)]
cannot be simplified to s[::len(s)].

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/108330043

10 years agosrc, misc: applied gofmt -w -s
Robert Griesemer [Tue, 1 Jul 2014 17:28:10 +0000 (10:28 -0700)]
src, misc: applied gofmt -w -s

TBR=rsc
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/111770043

10 years agogofmt/main: Added removal of empty declaration groups.
Simon Whitehead [Tue, 1 Jul 2014 16:32:03 +0000 (09:32 -0700)]
gofmt/main: Added removal of empty declaration groups.

Fixes #7631.

LGTM=gri
R=golang-codereviews, bradfitz, gri
CC=golang-codereviews
https://golang.org/cl/101410046

10 years agoA+C: Simon Whitehead (individual CLA)
Brad Fitzpatrick [Tue, 1 Jul 2014 16:26:06 +0000 (09:26 -0700)]
A+C: Simon Whitehead (individual CLA)

Generated by a+c.

R=gobot, rsc
CC=golang-codereviews
https://golang.org/cl/106340043

10 years agocodereview: update name of the a+c tool
Brad Fitzpatrick [Tue, 1 Jul 2014 16:25:34 +0000 (09:25 -0700)]
codereview: update name of the a+c tool

LGTM=rsc
R=rsc, minux
CC=golang-codereviews
https://golang.org/cl/105480043

10 years agodoc/go1.4.txt: delete editor and shell support
Rob Pike [Tue, 1 Jul 2014 16:22:55 +0000 (09:22 -0700)]
doc/go1.4.txt: delete editor and shell support

CC=golang-codereviews
https://golang.org/cl/101590043

10 years agomisc: delete editor and shell support
Rob Pike [Tue, 1 Jul 2014 16:21:25 +0000 (09:21 -0700)]
misc: delete editor and shell support

We are not the right people to support editor plugins, and the profusion
of editors in this CL demonstrates the unreality of pretending to do so.
People are free to create and advertise their own repos with support.

For discussion: https://groups.google.com/forum/#!topic/golang-dev/SA7fD470FxU

LGTM=rminnich, kamil.kisiel, gri, rsc, dave, josharian, ruiu
R=golang-codereviews, rminnich, kamil.kisiel, gri, rsc, dominik.honnef, dave, josharian, ruiu, ajstarks
CC=golang-codereviews
https://golang.org/cl/105470043

10 years agocmd/8g: don't allocate a register early for cap(CHAN).
Rémy Oudompheng [Tue, 1 Jul 2014 07:20:51 +0000 (09:20 +0200)]
cmd/8g: don't allocate a register early for cap(CHAN).

There is no reason to generate different code for cap and len.

Fixes #8025.
Fixes #8026.

LGTM=rsc
R=rsc, iant, khr
CC=golang-codereviews
https://golang.org/cl/93570044

10 years agoundo CL 104200047 / 318b04f28372
Keith Randall [Tue, 1 Jul 2014 02:48:08 +0000 (19:48 -0700)]
undo CL 104200047 / 318b04f28372

Breaks windows and race detector.
TBR=rsc

««« original CL description
runtime: stack allocator, separate from mallocgc

In order to move malloc to Go, we need to have a
separate stack allocator.  If we run out of stack
during malloc, malloc will not be available
to allocate a new stack.

Stacks are the last remaining FlagNoGC objects in the
GC heap.  Once they are out, we can get rid of the
distinction between the allocated/blockboundary bits.
(This will be in a separate change.)

Fixes #7468
Fixes #7424

LGTM=rsc, dvyukov
R=golang-codereviews, dvyukov, khr, dave, rsc
CC=golang-codereviews
https://golang.org/cl/104200047
»»»

TBR=rsc
CC=golang-codereviews
https://golang.org/cl/101570044

10 years agoruntime: stack allocator, separate from mallocgc
Keith Randall [Tue, 1 Jul 2014 01:59:24 +0000 (18:59 -0700)]
runtime: stack allocator, separate from mallocgc

In order to move malloc to Go, we need to have a
separate stack allocator.  If we run out of stack
during malloc, malloc will not be available
to allocate a new stack.

Stacks are the last remaining FlagNoGC objects in the
GC heap.  Once they are out, we can get rid of the
distinction between the allocated/blockboundary bits.
(This will be in a separate change.)

Fixes #7468
Fixes #7424

LGTM=rsc, dvyukov
R=golang-codereviews, dvyukov, khr, dave, rsc
CC=golang-codereviews
https://golang.org/cl/104200047

10 years agoruntime: update arm comments now register m is gone
David Crawshaw [Mon, 30 Jun 2014 23:10:41 +0000 (19:10 -0400)]
runtime: update arm comments now register m is gone

LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews
https://golang.org/cl/109220046

10 years agoencoding/gob: simplify allocation in decode.
Rob Pike [Mon, 30 Jun 2014 22:47:11 +0000 (15:47 -0700)]
encoding/gob: simplify allocation in decode.
The old code's structure needed to track indirections because of the
use of unsafe. That is no longer necessary, so we can remove all
that tracking. The code cleans up considerably but is a little slower.
We may be able to recover that performance drop. I believe the
code quality improvement is worthwhile regardless.

BenchmarkEndToEndPipe           5610          5780          +3.03%
BenchmarkEndToEndByteBuffer     3156          3222          +2.09%

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/103700043

10 years agogofmt: remove redundant check in rewriter
Robert Griesemer [Mon, 30 Jun 2014 21:40:12 +0000 (14:40 -0700)]
gofmt: remove redundant check in rewriter

If the actual types of two reflect values are
the same and the values are structs, they must
have the same number of fields.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/108280043

10 years agodoc/go1.4.txt: encoding/gob is now safe
Rob Pike [Mon, 30 Jun 2014 19:28:20 +0000 (12:28 -0700)]
doc/go1.4.txt: encoding/gob is now safe

CC=golang-codereviews
https://golang.org/cl/103690043

10 years agoencoding/gob: remove unsafe, use reflection.
Rob Pike [Mon, 30 Jun 2014 18:06:47 +0000 (11:06 -0700)]
encoding/gob: remove unsafe, use reflection.
This removes a major unsafe thorn in our side, a perennial obstacle
to clean garbage collection.
Not coincidentally: In cleaning this up, several bugs were found,
including code that reached inside by-value interfaces to create
pointers for pointer-receiver methods. Unsafe code is just as
advertised.

Performance of course suffers, but not too badly. The Pipe number
is more indicative, since it's doing I/O that simulates a network
connection. Plus these are end-to-end, so each end suffers
only half of this pain.

The edit is pretty much a line-by-line conversion, with a few
simplifications and a couple of new tests. There may be more
performance to gain.

BenchmarkEndToEndByteBuffer     2493          3033          +21.66%
BenchmarkEndToEndPipe           4953          5597          +13.00%

Fixes #5159.

LGTM=rsc
R=rsc
CC=golang-codereviews, khr
https://golang.org/cl/102680045

10 years agotest/fixedbugs: fix typo in comment
Dave Cheney [Sun, 29 Jun 2014 10:34:35 +0000 (20:34 +1000)]
test/fixedbugs: fix typo in comment

Fix copy paste error pointed out by rsc, https://golang.org/cl/107290043/diff/60001/test/fixedbugs/issue8074.go#newcode7

LGTM=ruiu, r
R=golang-codereviews, ruiu, r
CC=golang-codereviews
https://golang.org/cl/106210047

10 years agoruntime: fix GC bitmap corruption
Dmitriy Vyukov [Sun, 29 Jun 2014 02:20:46 +0000 (19:20 -0700)]
runtime: fix GC bitmap corruption
Fixes #8299.

R=golang-codereviews
CC=golang-codereviews, khr, rsc
https://golang.org/cl/103640044

10 years agostrings: Replacer is safe for concurrent use
Evan Shaw [Sat, 28 Jun 2014 22:53:07 +0000 (15:53 -0700)]
strings: Replacer is safe for concurrent use

LGTM=r
R=golang-codereviews, bradfitz, r
CC=golang-codereviews
https://golang.org/cl/109220044

10 years agocrypto/cipher: Fix typo in example comment
Preetam Jinka [Sat, 28 Jun 2014 17:11:26 +0000 (10:11 -0700)]
crypto/cipher: Fix typo in example comment

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/101510047

10 years agoflag: add a little more doc comment to Duration.
David Symonds [Sat, 28 Jun 2014 10:47:06 +0000 (20:47 +1000)]
flag: add a little more doc comment to Duration.

The only text that describes the accepted format is in the package doc,
which is far away from these functions. The other flag types don't need
this explicitness because they are more obvious.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/101550043

10 years agonet/http: add TLS benchmark
Dmitriy Vyukov [Sat, 28 Jun 2014 01:30:09 +0000 (18:30 -0700)]
net/http: add TLS benchmark

R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/110080045

10 years agoruntime: make garbage collector faster by deleting code again
Dmitriy Vyukov [Sat, 28 Jun 2014 01:19:02 +0000 (18:19 -0700)]
runtime: make garbage collector faster by deleting code again
Remove GC bitmap backward scanning.
This was already done once in https://golang.org/cl/5530074/
Still makes GC a bit faster.
On the garbage benchmark, before:
        gc-pause-one=237345195
        gc-pause-total=4746903
        cputime=32427775
        time=32458208
after:
        gc-pause-one=235484019
        gc-pause-total=4709680
        cputime=31861965
        time=31877772
Also prepares mgc0.c for future changes.

R=golang-codereviews, khr, khr
CC=golang-codereviews, rsc
https://golang.org/cl/105380043

10 years agoruntime: fix nacl amd64p32 flakiness
Russ Cox [Sat, 28 Jun 2014 00:13:16 +0000 (20:13 -0400)]
runtime: fix nacl amd64p32 flakiness

newproc takes two extra pointers, not two extra registers.
On amd64p32 (nacl) they are different.

We diagnosed this before the 1.3 cut but the tree was frozen.
I believe this is causing the random problems on the builder.

Fixes #8199.

TBR=r
CC=golang-codereviews
https://golang.org/cl/102710043

10 years agocmd/go: build non-runnable examples in xtests
Andrew Gerrand [Fri, 27 Jun 2014 21:15:22 +0000 (07:15 +1000)]
cmd/go: build non-runnable examples in xtests

Include these files in the build,
even though they don't get executed.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/108180043

10 years agonet/http: [Post]FormValue ignores parse errors
Evan Shaw [Fri, 27 Jun 2014 18:21:57 +0000 (11:21 -0700)]
net/http: [Post]FormValue ignores parse errors

LGTM=r
R=golang-codereviews, bradfitz, r
CC=golang-codereviews
https://golang.org/cl/102640046

10 years agoruntime: fix Plan 9 build
Anthony Martin [Fri, 27 Jun 2014 13:36:41 +0000 (15:36 +0200)]
runtime: fix Plan 9 build

LGTM=0intro, aram
R=rsc, 0intro, aram
CC=golang-codereviews
https://golang.org/cl/109240044

10 years agoruntime: improve scheduler trace
Dmitriy Vyukov [Fri, 27 Jun 2014 00:16:43 +0000 (17:16 -0700)]
runtime: improve scheduler trace
Output number of spinning threads,
this is useful to understanding whether the scheduler
is in a steady state or not.

R=golang-codereviews, khr
CC=golang-codereviews, rsc
https://golang.org/cl/103540045

10 years agostrings: avoid pointless slice growth in makeBenchInputHard
Josh Bleecher Snyder [Thu, 26 Jun 2014 20:00:47 +0000 (13:00 -0700)]
strings: avoid pointless slice growth in makeBenchInputHard

LGTM=ruiu
R=golang-codereviews, ruiu
CC=golang-codereviews
https://golang.org/cl/108150043

10 years agoruntime: say when a goroutine is locked to OS thread
Dmitriy Vyukov [Thu, 26 Jun 2014 18:40:48 +0000 (11:40 -0700)]
runtime: say when a goroutine is locked to OS thread
Say when a goroutine is locked to OS thread in crash reports
and goroutine profiles.
It can be useful to understand what goroutines consume OS threads
(syscall and locked), e.g. if you forget to call UnlockOSThread
or leak locked goroutines.

R=golang-codereviews
CC=golang-codereviews, rsc
https://golang.org/cl/94170043

10 years agocmd/gc: moved usefield to correct section of go.h, from "reflect.c" to "walk.c".
Evan Kroske [Thu, 26 Jun 2014 17:02:16 +0000 (10:02 -0700)]
cmd/gc: moved usefield to correct section of go.h, from "reflect.c" to "walk.c".

LGTM=iant
R=golang-codereviews, gobot, iant, dave
CC=golang-codereviews
https://golang.org/cl/108990044

10 years agoC: add Evan Kroske (Google CLA)
Ian Lance Taylor [Thu, 26 Jun 2014 17:01:28 +0000 (10:01 -0700)]
C: add Evan Kroske (Google CLA)

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/110160045

10 years agogo/parser: permit parentheses in receiver types
Robert Griesemer [Thu, 26 Jun 2014 16:45:11 +0000 (09:45 -0700)]
go/parser: permit parentheses in receiver types

Pending acceptance of CL 101500044
and adjustment of test/fixedbugs/bug299.go.

LGTM=adonovan
R=golang-codereviews, adonovan
CC=golang-codereviews
https://golang.org/cl/110160043

10 years agoall: remove 'extern register M *m' from runtime
Russ Cox [Thu, 26 Jun 2014 15:54:39 +0000 (11:54 -0400)]
all: remove 'extern register M *m' from runtime

The runtime has historically held two dedicated values g (current goroutine)
and m (current thread) in 'extern register' slots (TLS on x86, real registers
backed by TLS on ARM).

This CL removes the extern register m; code now uses g->m.

On ARM, this frees up the register that formerly held m (R9).
This is important for NaCl, because NaCl ARM code cannot use R9 at all.

The Go 1 macrobenchmarks (those with per-op times >= 10 µs) are unaffected:

BenchmarkBinaryTree17              5491374955     5471024381     -0.37%
BenchmarkFannkuch11                4357101311     4275174828     -1.88%
BenchmarkGobDecode                 11029957       11364184       +3.03%
BenchmarkGobEncode                 6852205        6784822        -0.98%
BenchmarkGzip                      650795967      650152275      -0.10%
BenchmarkGunzip                    140962363      141041670      +0.06%
BenchmarkHTTPClientServer          71581          73081          +2.10%
BenchmarkJSONEncode                31928079       31913356       -0.05%
BenchmarkJSONDecode                117470065      113689916      -3.22%
BenchmarkMandelbrot200             6008923        5998712        -0.17%
BenchmarkGoParse                   6310917        6327487        +0.26%
BenchmarkRegexpMatchMedium_1K      114568         114763         +0.17%
BenchmarkRegexpMatchHard_1K        168977         169244         +0.16%
BenchmarkRevcomp                   935294971      914060918      -2.27%
BenchmarkTemplate                  145917123      148186096      +1.55%

Minux previous reported larger variations, but these were caused by
run-to-run noise, not repeatable slowdowns.

Actual code changes by Minux.
I only did the docs and the benchmarking.

LGTM=dvyukov, iant, minux
R=minux, josharian, iant, dave, bradfitz, dvyukov
CC=golang-codereviews
https://golang.org/cl/109050043

10 years agocmd/gc: drop parenthesization restriction for receiver types
Russ Cox [Wed, 25 Jun 2014 13:57:48 +0000 (09:57 -0400)]
cmd/gc: drop parenthesization restriction for receiver types

Matches CL 101500044.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/110160044

10 years agoindex/suffixarray: reduce size of a benchmark
Dmitriy Vyukov [Wed, 25 Jun 2014 03:37:28 +0000 (20:37 -0700)]
index/suffixarray: reduce size of a benchmark
A single iteration of BenchmarkSaveRestore runs for 5 seconds
on my freebsd machine. 5 seconds looks like too long for a single
iteration.
This is the only benchmark that times out on freebsd-amd64-race builder.

R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/107340044

10 years agoundo CL 107320046 / 97cd07dcb9d8
Andrew Gerrand [Wed, 25 Jun 2014 02:04:36 +0000 (12:04 +1000)]
undo CL 107320046 / 97cd07dcb9d8

Breaks the build

««« original CL description
cmd/go: build test files containing non-runnable examples

Even if we can't run them, we should at least check that they compile.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/107320046
»»»

TBR=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/110140044

10 years agoregexp: skip TestOnePassCutoff in short mode
Dmitriy Vyukov [Wed, 25 Jun 2014 00:19:10 +0000 (17:19 -0700)]
regexp: skip TestOnePassCutoff in short mode
Runs for 4 seconds on my mac.
Also this is the only test that times out on freebsd in -race mode.

R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/110150045

10 years agofmt: fix typo in help doc
Mihai Borobocea [Tue, 24 Jun 2014 23:59:33 +0000 (16:59 -0700)]
fmt: fix typo in help doc

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/110110045

10 years agoA+C: add Tetsuo Kiso (personal CLA)
Ian Lance Taylor [Tue, 24 Jun 2014 23:33:32 +0000 (16:33 -0700)]
A+C: add Tetsuo Kiso (personal CLA)

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/101520043

10 years agospec: receiver declaration is just a parameter declaration
Robert Griesemer [Tue, 24 Jun 2014 23:25:09 +0000 (16:25 -0700)]
spec: receiver declaration is just a parameter declaration

This CL removes the special syntax for method receivers and
makes it just like other parameters. Instead, the crucial
receiver-specific rules (exactly one receiver, receiver type
must be of the form T or *T) are specified verbally instead
of syntactically.

This is a fully backward-compatible (and minor) syntax
relaxation. As a result, the following syntactic restrictions
(which are completely irrelevant) and which were only in place
for receivers are removed:

a) receiver types cannot be parenthesized
b) receiver parameter lists cannot have a trailing comma

The result of this CL is a simplication of the spec and the
implementation, with no impact on existing (or future) code.

Noteworthy:

- gc already permits a trailing comma at the end of a receiver
  declaration:

  func (recv T,) m() {}

  This is technically a bug with the current spec; this CL will
  legalize this notation.

- gccgo produces a misleading error when a trailing comma is used:

  error: method has multiple receivers

  (even though there's only one receiver)

- Compilers and type-checkers won't need to report errors anymore
  if receiver types are parenthesized.

Fixes #4496.

LGTM=iant, rsc
R=r, rsc, iant, ken
CC=golang-codereviews
https://golang.org/cl/101500044

10 years agorace.bash: support freebsd
Dmitriy Vyukov [Tue, 24 Jun 2014 22:47:22 +0000 (15:47 -0700)]
race.bash: support freebsd

R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/110150044

10 years agocmd/go: build test files containing non-runnable examples
Andrew Gerrand [Tue, 24 Jun 2014 22:22:22 +0000 (08:22 +1000)]
cmd/go: build test files containing non-runnable examples

Even if we can't run them, we should at least check that they compile.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/107320046

10 years agosyscall: implement setresuid(2) and setresgid(2) on OpenBSD/FreeBSD/DragonflyBSD
William Orr [Tue, 24 Jun 2014 20:30:30 +0000 (13:30 -0700)]
syscall: implement setresuid(2) and setresgid(2) on OpenBSD/FreeBSD/DragonflyBSD

Fixes #8218.

LGTM=iant
R=golang-codereviews, iant, minux
CC=golang-codereviews
https://golang.org/cl/107150043

10 years agosyscall: add source-specific multicast socket options for Darwin
Mikio Hara [Tue, 24 Jun 2014 20:01:09 +0000 (05:01 +0900)]
syscall: add source-specific multicast socket options for Darwin

Update #8266

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/101460043

10 years agoC: add Glenn Lewis (Google CLA)
Glenn Lewis [Tue, 24 Jun 2014 19:52:48 +0000 (05:52 +1000)]
C: add Glenn Lewis (Google CLA)

For work on goauth2.

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/110150043

10 years agodoc/go1.4.txt: text/scanner: IsIdentRune
Rob Pike [Tue, 24 Jun 2014 18:09:13 +0000 (11:09 -0700)]
doc/go1.4.txt: text/scanner: IsIdentRune

R=gri
CC=golang-codereviews
https://golang.org/cl/104340043

10 years agostrings: additional tests
Dave Cheney [Tue, 24 Jun 2014 17:06:07 +0000 (03:06 +1000)]
strings: additional tests

This CL re-applies the tests added in CL 101330053 and subsequently rolled back in CL 102610043.

The original author of this change was Rui Ueyama <ruiu@google.com>

LGTM=r, ruiu
R=ruiu, r
CC=golang-codereviews
https://golang.org/cl/109170043

10 years agotesting: make benchmarking faster
Josh Bleecher Snyder [Tue, 24 Jun 2014 15:39:30 +0000 (08:39 -0700)]
testing: make benchmarking faster

The number of estimated iterations required to reach the benchtime is multiplied by a safety margin (to avoid falling just short) and then rounded up to a readable number. With an accurate estimate, in the worse case, the resulting number of iterations could be 3.75x more than necessary: 1.5x for safety * 2.5x to round up (e.g. from 2eX+1 to 5eX).

This CL reduces the safety margin to 1.2x. Experimentation showed a diminishing margin of return past 1.2x, although the average case continued to show improvements down to 1.05x.

This CL also reduces the maximum round-up multiplier from 2.5x (from 2eX+1 to 5eX) to 2x, by allowing the number of iterations to be of the form 3eX.

Both changes improve benchmark wall clock times, and the effects are cumulative.

From 1.5x to 1.2x safety margin:

package old s new s delta
bytes 163 125 -23%
encoding/json 27 21 -22%
net/http 42 36 -14%
runtime 463 418 -10%
strings 82 65 -21%

Allowing 3eX iterations:

package old s new s delta
bytes 163 134 -18%
encoding/json 27 23 -15%
net/http 42 36 -14%
runtime 463 422 -9%
strings 82 72 -12%

Combined:

package old s new s delta
bytes 163 112 -31%
encoding/json 27 20 -26%
net/http 42 30 -29%
runtime 463 346 -25%
strings 82 60 -27%

LGTM=crawshaw, r, rsc
R=golang-codereviews, crawshaw, r, rsc
CC=golang-codereviews
https://golang.org/cl/105990045

10 years agonet/http: remove a duplicated check
Robert Obryk [Tue, 24 Jun 2014 00:38:17 +0000 (17:38 -0700)]
net/http: remove a duplicated check

The previous call to parseRange already checks whether
all the ranges start before the end of file.

LGTM=robert.hencke, bradfitz
R=golang-codereviews, robert.hencke, gobot, bradfitz
CC=golang-codereviews
https://golang.org/cl/91880044

10 years agosyscall: regenerate z-files for darwin
Mikio Hara [Tue, 24 Jun 2014 00:20:42 +0000 (09:20 +0900)]
syscall: regenerate z-files for darwin

Updates z-files from 10.7 kernel-based to 10.9 kernel-based.

LGTM=iant
R=golang-codereviews, bradfitz, iant
CC=golang-codereviews
https://golang.org/cl/102610045

10 years agodoc/go1.4: add note about Set{uid,gid} change
Dave Cheney [Mon, 23 Jun 2014 23:50:10 +0000 (09:50 +1000)]
doc/go1.4: add note about Set{uid,gid} change

LGTM=iant
R=ruiu, iant
CC=golang-codereviews
https://golang.org/cl/107320044

10 years agosyscall: disable Setuid/Setgid on linux
Dave Cheney [Mon, 23 Jun 2014 23:16:24 +0000 (09:16 +1000)]
syscall: disable Setuid/Setgid on linux

Update #1435

This proposal disables Setuid and Setgid on all linux platforms.

Issue 1435 has been open for a long time, and it is unlikely to be addressed soon so an argument was made by a commenter

https://code.google.com/p/go/issues/detail?id=1435#c45

That these functions should made to fail rather than succeed in their broken state.

LGTM=ruiu, iant
R=iant, ruiu
CC=golang-codereviews
https://golang.org/cl/106170043

10 years agosyscall: add source-specific multicast socket options for FreeBSD
Mikio Hara [Mon, 23 Jun 2014 22:03:44 +0000 (07:03 +0900)]
syscall: add source-specific multicast socket options for FreeBSD

Update #8266

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/104290043

10 years agoruntime: speed up amd64 memmove
Rui Ueyama [Mon, 23 Jun 2014 19:06:26 +0000 (12:06 -0700)]
runtime: speed up amd64 memmove

MOV with SSE registers seems faster than REP MOVSQ if the
size being copied is less than about 2K. Previously we
didn't use MOV if the memory region is larger than 256
byte. This patch improves the performance of 257 ~ 2048
byte non-overlapping copy by using MOV.

Here is the benchmark result on Intel Xeon 3.5GHz (Nehalem).

benchmark               old ns/op    new ns/op    delta
BenchmarkMemmove16              4            4   +0.42%
BenchmarkMemmove32              5            5   -0.20%
BenchmarkMemmove64              6            6   -0.81%
BenchmarkMemmove128             7            7   -0.82%
BenchmarkMemmove256            10           10   +1.92%
BenchmarkMemmove512            29           16  -44.90%
BenchmarkMemmove1024           37           25  -31.55%
BenchmarkMemmove2048           55           44  -19.46%
BenchmarkMemmove4096           92           91   -0.76%

benchmark                old MB/s     new MB/s  speedup
BenchmarkMemmove16        3370.61      3356.88    1.00x
BenchmarkMemmove32        6368.68      6386.99    1.00x
BenchmarkMemmove64       10367.37     10462.62    1.01x
BenchmarkMemmove128      17551.16     17713.48    1.01x
BenchmarkMemmove256      24692.81     24142.99    0.98x
BenchmarkMemmove512      17428.70     31687.72    1.82x
BenchmarkMemmove1024     27401.82     40009.45    1.46x
BenchmarkMemmove2048     36884.86     45766.98    1.24x
BenchmarkMemmove4096     44295.91     44627.86    1.01x

LGTM=khr
R=golang-codereviews, gobot, khr
CC=golang-codereviews
https://golang.org/cl/90500043

10 years agosyscall: consolidate, simplify socket options for Unix-like systems
Mikio Hara [Mon, 23 Jun 2014 09:46:01 +0000 (18:46 +0900)]
syscall: consolidate, simplify socket options for Unix-like systems

Also exposes common socket option functions on Solaris.

Update #7174
Update #7175

LGTM=aram
R=golang-codereviews, aram
CC=golang-codereviews
https://golang.org/cl/107280044

10 years agosyscall: don't display syscall prototype lines on godoc
Mikio Hara [Mon, 23 Jun 2014 05:33:33 +0000 (14:33 +0900)]
syscall: don't display syscall prototype lines on godoc

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/110020050

10 years agoimage/png: remove unnecessary function call
Rui Ueyama [Mon, 23 Jun 2014 00:29:56 +0000 (10:29 +1000)]
image/png: remove unnecessary function call

paeth(0, x, 0) == x for any uint8 value.

LGTM=nigeltao
R=golang-codereviews, bradfitz, nigeltao
CC=golang-codereviews
https://golang.org/cl/105290049

10 years agoundo CL 101330053 / c19c9a063fe8
Rui Ueyama [Sun, 22 Jun 2014 22:26:30 +0000 (15:26 -0700)]
undo CL 101330053 / c19c9a063fe8

sync.Pool is not supposed to be used everywhere, but is
a last resort.

««« original CL description
strings: use sync.Pool to cache buffer

benchmark                         old ns/op    new ns/op    delta
BenchmarkByteReplacerWriteString       3596         3094  -13.96%

benchmark                        old allocs   new allocs    delta
BenchmarkByteReplacerWriteString          1            0  -100.00%

LGTM=dvyukov
R=bradfitz, dave, dvyukov
CC=golang-codereviews
https://golang.org/cl/101330053
»»»

LGTM=dave
R=r, dave
CC=golang-codereviews
https://golang.org/cl/102610043

10 years agotest: add test case for issue 8074.
Dave Cheney [Sun, 22 Jun 2014 07:33:00 +0000 (17:33 +1000)]
test: add test case for issue 8074.

Fixes #8074.

The issue was not reproduceable by revision

go version devel +e0ad7e329637 Thu Jun 19 22:19:56 2014 -0700 linux/arm

But include the original test case in case the issue reopens itself.

LGTM=dvyukov
R=golang-codereviews, dvyukov
CC=golang-codereviews
https://golang.org/cl/107290043

10 years agostrings: use sync.Pool to cache buffer
Rui Ueyama [Sun, 22 Jun 2014 05:08:43 +0000 (22:08 -0700)]
strings: use sync.Pool to cache buffer

benchmark                         old ns/op    new ns/op    delta
BenchmarkByteReplacerWriteString       3596         3094  -13.96%

benchmark                        old allocs   new allocs    delta
BenchmarkByteReplacerWriteString          1            0  -100.00%

LGTM=dvyukov
R=bradfitz, dave, dvyukov
CC=golang-codereviews
https://golang.org/cl/101330053

10 years agodoc: say that race detector is supported on freebsd
Dmitriy Vyukov [Sat, 21 Jun 2014 16:19:49 +0000 (20:19 +0400)]
doc: say that race detector is supported on freebsd

R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/103520044

10 years agodoc: say that race detector is supported on freebsd
Dmitriy Vyukov [Sat, 21 Jun 2014 16:19:32 +0000 (20:19 +0400)]
doc: say that race detector is supported on freebsd

LGTM=ruiu
R=golang-codereviews, ruiu
CC=golang-codereviews
https://golang.org/cl/109100046

10 years agorun.bash: run race tests on freebsd
Dmitriy Vyukov [Sat, 21 Jun 2014 00:54:18 +0000 (20:54 -0400)]
run.bash: run race tests on freebsd

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/102580043

10 years agoruntime/race: support freebsd
Dmitriy Vyukov [Sat, 21 Jun 2014 00:20:56 +0000 (20:20 -0400)]
runtime/race: support freebsd
All tests pass except one test in regexp package.

LGTM=iant
R=golang-codereviews, iant, dave
CC=golang-codereviews
https://golang.org/cl/107270043

10 years agoruntime/race: update linux runtime
Dmitriy Vyukov [Fri, 20 Jun 2014 23:54:16 +0000 (03:54 +0400)]
runtime/race: update linux runtime
It was built on an old, bogus revision.

LGTM=minux
TBR=iant
R=iant, minux
CC=golang-codereviews
https://golang.org/cl/101370052

10 years agoruntime/race: update runtime to tip
Dmitriy Vyukov [Fri, 20 Jun 2014 23:36:21 +0000 (16:36 -0700)]
runtime/race: update runtime to tip
This requires minimal changes to the runtime hooks. In particular,
synchronization events must be done only on valid addresses now,
so I've added the additional checks to race.c.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/101000046

10 years agostrings: speed up byteReplacer.Replace
Rui Ueyama [Fri, 20 Jun 2014 19:18:33 +0000 (12:18 -0700)]
strings: speed up byteReplacer.Replace

benchmark                         old ns/op    new ns/op    delta
BenchmarkByteReplacerWriteString       7359         3661  -50.25%

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/102550043

10 years agosync: detect incorrect usages of RWMutex
Dmitriy Vyukov [Fri, 20 Jun 2014 05:19:56 +0000 (22:19 -0700)]
sync: detect incorrect usages of RWMutex
Fixes #7858.

LGTM=ruiu
R=ruiu
CC=golang-codereviews
https://golang.org/cl/92720045

10 years agonet: simplify code
Dmitriy Vyukov [Fri, 20 Jun 2014 05:04:37 +0000 (22:04 -0700)]
net: simplify code
Single-case select with a non-nil channel is pointless.

LGTM=mikioh.mikioh
R=mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/103920044

10 years agoruntime: remove obsolete afterprologue check
Dmitriy Vyukov [Fri, 20 Jun 2014 05:04:10 +0000 (22:04 -0700)]
runtime: remove obsolete afterprologue check
Afterprologue check was required when did not know
about return arguments of functions and/or they were not zeroed.
Now 100% precision is required for stacks due to stack copying,
so it must work w/o afterprologue one way or another.
I can limit this change for 1.3 to merely adding a TODO,
but this check is super confusing so I don't want this knowledge to get lost.

LGTM=rsc
R=golang-codereviews, gobot, rsc, khr
CC=golang-codereviews, khr, rsc
https://golang.org/cl/96580045

10 years agostrings: define byteBitmap.isSet
Rui Ueyama [Fri, 20 Jun 2014 03:10:55 +0000 (20:10 -0700)]
strings: define byteBitmap.isSet

LGTM=dave
R=golang-codereviews, bradfitz, dave
CC=golang-codereviews
https://golang.org/cl/109090048

10 years agoencoding/base64, encoding/base32: speed up Encode
Rui Ueyama [Thu, 19 Jun 2014 19:04:59 +0000 (12:04 -0700)]
encoding/base64, encoding/base32: speed up Encode
Avoid unnecessary bitwise-OR operations.

benchmark                      old MB/s     new MB/s  speedup
BenchmarkEncodeToStringBase64  179.02       205.74    1.15x
BenchmarkEncodeToStringBase32  155.86       167.82    1.08x

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/109090043

10 years agostrings: reduce allocation in byteStringReplacer.WriteString
Rui Ueyama [Thu, 19 Jun 2014 18:22:50 +0000 (11:22 -0700)]
strings: reduce allocation in byteStringReplacer.WriteString

Use WriteString instead of allocating a byte slice as a
buffer. This was a TODO.

benchmark               old ns/op    new ns/op    delta
BenchmarkWriteString        40139        19991  -50.20%

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/107190044

10 years agoimage/jpeg: encode *image.Gray as grayscale JPEGs.
Bill Thiede [Thu, 19 Jun 2014 12:18:24 +0000 (22:18 +1000)]
image/jpeg: encode *image.Gray as grayscale JPEGs.

Fixes #8201.

LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/105990046

10 years agotesting/quick: brought Check parameter name in line with function doc
Caleb Spare [Thu, 19 Jun 2014 05:49:14 +0000 (01:49 -0400)]
testing/quick: brought Check parameter name in line with function doc

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/102830043

10 years agoimage/jpeg: use a look-up table to speed up Huffman decoding. This
Nigel Tao [Thu, 19 Jun 2014 01:39:03 +0000 (11:39 +1000)]
image/jpeg: use a look-up table to speed up Huffman decoding. This
requires a decoder to do its own byte buffering instead of using
bufio.Reader, due to byte stuffing.

benchmark                      old MB/s     new MB/s     speedup
BenchmarkDecodeBaseline        33.40        50.65        1.52x
BenchmarkDecodeProgressive     24.34        31.92        1.31x

On 6g, unsafe.Sizeof(huffman{}) falls from 4872 to 964 bytes, and
the decoder struct contains 8 of those.

LGTM=r
R=r, nightlyone
CC=bradfitz, couchmoney, golang-codereviews, raph
https://golang.org/cl/109050045

10 years agotag go1.3
Andrew Gerrand [Thu, 19 Jun 2014 01:21:35 +0000 (11:21 +1000)]
tag go1.3

LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews
https://golang.org/cl/107200043

10 years agodoc: document Go 1.3
Andrew Gerrand [Thu, 19 Jun 2014 00:26:57 +0000 (10:26 +1000)]
doc: document Go 1.3

This is a clone of 101370043, which I accidentally applied to the
release branch first.
No big deal, it needed to be applied there anyway.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/108090043

10 years agoimage: add RGBAAt, Gray16At, etc.
ChaiShushan [Thu, 19 Jun 2014 00:15:04 +0000 (10:15 +1000)]
image: add RGBAAt, Gray16At, etc.

Fixes #7694.

LGTM=nigeltao, rsc, r
R=golang-codereviews, nigeltao, rsc, r
CC=golang-codereviews
https://golang.org/cl/109000049

10 years agoencoding/base64, encoding/base32: make Encode faster
Rui Ueyama [Wed, 18 Jun 2014 19:05:46 +0000 (12:05 -0700)]
encoding/base64, encoding/base32: make Encode faster

Storing temporary values to a slice is slower than storing
them to local variables of type byte.

benchmark                         old MB/s     new MB/s  speedup
BenchmarkEncodeToStringBase32       102.21       156.66    1.53x
BenchmarkEncodeToStringBase64       124.25       177.91    1.43x

LGTM=crawshaw
R=golang-codereviews, crawshaw, bradfitz, dave
CC=golang-codereviews
https://golang.org/cl/109820045

10 years agotesting: fix timing format inconsistency
Robert Dinu [Wed, 18 Jun 2014 17:59:25 +0000 (10:59 -0700)]
testing: fix timing format inconsistency

Fixes #8175.

LGTM=r
R=golang-codereviews, r, gobot
CC=golang-codereviews
https://golang.org/cl/103320043

10 years agofmt: include ±Inf and NaN in the complex format test
Rob Pike [Wed, 18 Jun 2014 17:57:18 +0000 (10:57 -0700)]
fmt: include ±Inf and NaN in the complex format test
Just to be more thorough.
No need to push this to 1.3; it's just a test change that
worked without any changes to the code being tested.

LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews
https://golang.org/cl/109080045