Commit Graph

13237 Commits

Author SHA1 Message Date
Rémy Oudompheng
c4a814f2da runtime/pprof, misc/pprof: correct profile of total allocations.
The previous heap profile format did not include buckets with
zero used bytes. Also add several missing MemStats fields in
debug mode.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/6249068
2012-05-31 07:57:49 +02:00
Nigel Tao
bb4a817a92 exp/html/atom: new package.
50% fewer mallocs in HTML tokenization, resulting in 25% fewer mallocs
in parsing go1.html.

Making the parser use integer comparisons instead of string comparisons
will be a follow-up CL, to be co-ordinated with Andy Balholm's work.

exp/html benchmarks before/after:

BenchmarkParser	     500	   4754294 ns/op	  16.44 MB/s
        parse_test.go:409: 500 iterations, 14651 mallocs per iteration
BenchmarkRawLevelTokenizer	    2000	    903481 ns/op	  86.51 MB/s
        token_test.go:678: 2000 iterations, 28 mallocs per iteration
BenchmarkLowLevelTokenizer	    2000	   1260485 ns/op	  62.01 MB/s
        token_test.go:678: 2000 iterations, 41 mallocs per iteration
BenchmarkHighLevelTokenizer	    1000	   2165964 ns/op	  36.09 MB/s
        token_test.go:678: 1000 iterations, 6616 mallocs per iteration

BenchmarkParser	     500	   4664912 ns/op	  16.76 MB/s
        parse_test.go:409: 500 iterations, 11266 mallocs per iteration
BenchmarkRawLevelTokenizer	    2000	    903065 ns/op	  86.55 MB/s
        token_test.go:678: 2000 iterations, 28 mallocs per iteration
BenchmarkLowLevelTokenizer	    2000	   1260032 ns/op	  62.03 MB/s
        token_test.go:678: 2000 iterations, 41 mallocs per iteration
BenchmarkHighLevelTokenizer	    1000	   2143356 ns/op	  36.47 MB/s
        token_test.go:678: 1000 iterations, 3231 mallocs per iteration

R=r, rsc, rogpeppe
CC=andybalholm, golang-dev
https://golang.org/cl/6255062
2012-05-31 15:37:18 +10:00
Rob Pike
43cf5505fc regexp: fix a couple of bugs in the documentation
Byte slices are not strings.

Fixes #3687.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6257074
2012-05-30 21:57:50 -07:00
Andrew Gerrand
735ec94591 misc/dashboard/app: add debug logging to notifyOnFailure; remove unused Result.OK function
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6258064
2012-05-31 14:09:50 +10:00
Andrew Gerrand
023a7e881c misc/dashboard/app: fix tests
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6244069
2012-05-31 14:09:24 +10:00
Dave Cheney
5b2cd445fb cmd/go: add -ccflags
Add -ccflags to pass arguments to {5,6,8}c
similar to -gcflags for {5,6,8}g.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6260047
2012-05-31 09:10:03 +10:00
Russ Cox
001b75c942 cmd/gc: contiguous loop layout
Drop expecttaken function in favor of extra argument
to gbranch and bgen. Mark loop condition as likely to
be true, so that loops are generated inline.

The main benefit here is contiguous code when trying
to read the generated assembly. It has only minor effects
on the timing, and they mostly cancel the minor effects
that aligning function entry points had.  One exception:
both changes made Fannkuch faster.

Compared to before CL 6244066 (before aligned functions)
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    4222117400   4201958800   -0.48%
BenchmarkFannkuch11      3462631800   3215908600   -7.13%
BenchmarkGobDecode         20887622     20899164   +0.06%
BenchmarkGobEncode          9548772      9439083   -1.15%
BenchmarkGzip                151687       152060   +0.25%
BenchmarkGunzip                8742         8711   -0.35%
BenchmarkJSONEncode        62730560     62686700   -0.07%
BenchmarkJSONDecode       252569180    252368960   -0.08%
BenchmarkMandelbrot200      5267599      5252531   -0.29%
BenchmarkRevcomp25M       980813500    985248400   +0.45%
BenchmarkTemplate         361259100    357414680   -1.06%

Compared to tip (aligned functions):
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    4140739800   4201958800   +1.48%
BenchmarkFannkuch11      3259914400   3215908600   -1.35%
BenchmarkGobDecode         20620222     20899164   +1.35%
BenchmarkGobEncode          9384886      9439083   +0.58%
BenchmarkGzip                150333       152060   +1.15%
BenchmarkGunzip                8741         8711   -0.34%
BenchmarkJSONEncode        65210990     62686700   -3.87%
BenchmarkJSONDecode       249394860    252368960   +1.19%
BenchmarkMandelbrot200      5273394      5252531   -0.40%
BenchmarkRevcomp25M       996013800    985248400   -1.08%
BenchmarkTemplate         360620840    357414680   -0.89%

R=ken2
CC=golang-dev
https://golang.org/cl/6245069
2012-05-30 18:07:39 -04:00
Mikio Hara
aad8e95474 net: fix test to avoid unintentional nil pointer dereference
R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6248065
2012-05-31 06:12:24 +09:00
Russ Cox
6a5660f160 cmd/5l: fix PLD
Was missing break.

R=ken2
CC=golang-dev
https://golang.org/cl/6250078
2012-05-30 17:01:25 -04:00
Russ Cox
f2bd3a977d cmd/6l, cmd/8l, cmd/5l: add AUNDEF instruction
On 6l and 8l, this is a real instruction, guaranteed to
cause an 'undefined instruction' exception.

On 5l, we simulate it as BL to address 0.

The plan is to use it as a signal to the linker that this
point in the instruction stream cannot be reached
(hence the changes to nofollow).  This will help the
compiler explain that panicindex and friends do not
return without having to put a list of these functions
in the linker.

R=ken2
CC=golang-dev
https://golang.org/cl/6255064
2012-05-30 16:47:56 -04:00
Russ Cox
8820ab5da9 cmd/ld: align function entry on arch-specific boundary
16 seems pretty standard on x86 for function entry.
I don't know if ARM would benefit, so I used just 4
(single instruction alignment).

This has a minor absolute effect on the current timings.
The main hope is that it will make them more consistent from
run to run.

benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    4222117400   4140739800   -1.93%
BenchmarkFannkuch11      3462631800   3259914400   -5.85%
BenchmarkGobDecode         20887622     20620222   -1.28%
BenchmarkGobEncode          9548772      9384886   -1.72%
BenchmarkGzip                151687       150333   -0.89%
BenchmarkGunzip                8742         8741   -0.01%
BenchmarkJSONEncode        62730560     65210990   +3.95%
BenchmarkJSONDecode       252569180    249394860   -1.26%
BenchmarkMandelbrot200      5267599      5273394   +0.11%
BenchmarkRevcomp25M       980813500    996013800   +1.55%
BenchmarkTemplate         361259100    360620840   -0.18%

R=ken2
CC=golang-dev
https://golang.org/cl/6244066
2012-05-30 16:26:38 -04:00
Russ Cox
b91cf50585 cmd/6l, cmd/8l: fix chaining bug in jump rewrite
The code was inconsistent about when it used
brchain(x) and when it used x directly, with the result
that you could end up emitting code for brchain(x) but
leave the jump pointing at an unemitted x.

R=ken2
CC=golang-dev
https://golang.org/cl/6250077
2012-05-30 16:10:53 -04:00
Ivan Krasin
37f046bac6 compress/flate: fix overflow on 2GB input. Reset hashOffset every 16 MB.
This bug has been introduced in the following revision:

changeset:   11404:26dceba5c610
user:        Ivan Krasin <krasin@golang.org>
date:        Mon Jan 23 09:19:39 2012 -0500
summary:     compress/flate: reduce memory pressure at cost of additional arithmetic operation.

This is the review page for that CL: https://golang.org/cl/5555070/

R=rsc, imkrasin
CC=golang-dev
https://golang.org/cl/6249067
2012-05-30 16:08:38 -04:00
Mats Lidell
b8a02560de go-mode: Works for both GNU-Emacs and XEmacs-21.5
Fixes some portability issues between the Emacsen.

R=golang-dev, sameer, bradfitz, ryanb
CC=golang-dev
https://golang.org/cl/6206043
2012-05-30 16:04:29 -04:00
Rob Pike
6f3ffd4d79 test/bench/shootout: more speedups
Most significant in mandelbrot, from avoiding MOVSD between registers,
but there are others.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6258063
2012-05-30 12:31:28 -07:00
Russ Cox
a768de8347 cmd/6g: avoid MOVSD between registers
MOVSD only copies the low half of the packed register pair,
while MOVAPD copies both halves.  I assume the internal
register renaming works better with the latter, since it makes
our code run 25% faster.

Before:
mandelbrot 16000
        gcc -O2 mandelbrot.c	28.44u 0.00s 28.45r
        gc mandelbrot	44.12u 0.00s 44.13r
        gc_B mandelbrot	44.17u 0.01s 44.19r

After:
mandelbrot 16000
        gcc -O2 mandelbrot.c	28.22u 0.00s 28.23r
        gc mandelbrot	32.81u 0.00s 32.82r
        gc_B mandelbrot	32.82u 0.00s 32.83r

R=ken2
CC=golang-dev
https://golang.org/cl/6248068
2012-05-30 14:41:19 -04:00
Russ Cox
eb056dbea7 shootout: make mandelbrot.go more like mandelbrot.c
Surprise! The C code is using floating point values for its counters.
Its off the critical path, but the Go code and C code are supposed to
be as similar as possible to make comparisons meaningful.

It doesn't have a significant effect.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6260058
2012-05-30 14:40:59 -04:00
Sameer Ajmani
3806cc7b05 A+C: add Mats Lidell. He signed the agreement with the Sweden email
address, but his changelist is under the Gmail address.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6248069
2012-05-30 14:38:40 -04:00
Jean-Marc Eurin
7b6111a9dd misc/emacs: Use patch output of gofmt instead of replacing the buffer.
This uses the patch output of gofmt (-d option) and applies each
chunk to the buffer, instead of replacing the whole buffer.  The
main advantage is that the undo history is kept across gofmt'ings,
so it can really be used as a before-save-hook.

R=sameer, sameer
CC=golang-dev
https://golang.org/cl/6198047
2012-05-30 14:18:58 -04:00
Rob Pike
ec4d213594 test/bench/shootout/timing.log: mandelbrot is restored
R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6259054
2012-05-30 10:35:47 -07:00
Joel Sing
deb93b0f7b runtime: always initialise procid on netbsd
The correct procid is needed for unparking LWPs on NetBSD - always
initialise procid in minit() so that cgo works correctly. The non-cgo
case already works correctly since procid is initialised via
lwp_create().

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6257071
2012-05-31 03:27:04 +10:00
Jan Ziak
334bf95f9e runtime: update field types in preparation for GC changes
R=rsc, remyoudompheng, minux.ma, ality
CC=golang-dev
https://golang.org/cl/6242061
2012-05-30 13:07:52 -04:00
Joel Sing
586b6dfa46 cmd/ld: increase number of ELF sections
On NetBSD a cgo enabled binary has more than 32 sections - bump NSECTS
so that we can actually link them successfully.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6261052
2012-05-31 03:06:38 +10:00
Jan Ziak
46d7d5fcf5 runtime: hide symbol table from garbage collector
R=rsc
CC=golang-dev
https://golang.org/cl/6243059
2012-05-30 13:04:48 -04:00
Marcel van Lohuizen
c633f85f65 exp/locale/collate: avoid double building in maketables.go. Also added check.
R=r
CC=golang-dev
https://golang.org/cl/6202063
2012-05-30 17:47:56 +02:00
Russ Cox
cb9759d067 test/bench/go1: add mandelbrot for floating point
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6244063
2012-05-30 10:26:59 -04:00
Russ Cox
de96df1b02 cmd/6g: change sbop swap logic
I added the nl->op == OLITERAL case during the recent
performance round, and while it helps for small integer constants,
it hurts for floating point constants.  In the Mandelbrot benchmark
it causes 2*Zr*Zi to compile like Zr*2*Zi:

        0x000000000042663d <+249>:	movsd  %xmm6,%xmm0
        0x0000000000426641 <+253>:	movsd  $2,%xmm1
        0x000000000042664a <+262>:	mulsd  %xmm1,%xmm0
        0x000000000042664e <+266>:	mulsd  %xmm5,%xmm0

instead of:

        0x0000000000426835 <+276>:	movsd  $2,%xmm0
        0x000000000042683e <+285>:	mulsd  %xmm6,%xmm0
        0x0000000000426842 <+289>:	mulsd  %xmm5,%xmm0

It is unclear why that has such a dramatic performance effect
in a tight loop, but it's obviously slightly better code, so go with it.

benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    5957470000   5973924000   +0.28%
BenchmarkFannkuch11      3811295000   3869128000   +1.52%
BenchmarkGobDecode         26001900     25670500   -1.27%
BenchmarkGobEncode         12051430     11948590   -0.85%
BenchmarkGzip                177432       174821   -1.47%
BenchmarkGunzip               10967        10756   -1.92%
BenchmarkJSONEncode        78924750     79746900   +1.04%
BenchmarkJSONDecode       313606400    307081600   -2.08%
BenchmarkMandelbrot200     13670860      8200725  -40.01%  !!!
BenchmarkRevcomp25M      1179194000   1206539000   +2.32%
BenchmarkTemplate         447931200    443948200   -0.89%
BenchmarkMD5Hash1K             2856         2873   +0.60%
BenchmarkMD5Hash8K            22083        22029   -0.24%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkGobDecode            29.52        29.90    1.01x
BenchmarkGobEncode            63.69        64.24    1.01x
BenchmarkJSONEncode           24.59        24.33    0.99x
BenchmarkJSONDecode            6.19         6.32    1.02x
BenchmarkRevcomp25M          215.54       210.66    0.98x
BenchmarkTemplate              4.33         4.37    1.01x
BenchmarkMD5Hash1K           358.54       356.31    0.99x
BenchmarkMD5Hash8K           370.95       371.86    1.00x

R=ken2
CC=golang-dev
https://golang.org/cl/6261051
2012-05-30 10:22:33 -04:00
Nigel Tao
dbcdce5866 image/png: optimize paeth some more.
filterPaeth takes []byte arguments instead of byte arguments,
which avoids some redudant computation of the previous pixel
in the inner loop.

Also eliminate a bounds check in decoding the up filter.

benchmark                       old ns/op    new ns/op    delta
BenchmarkDecodeGray               3139636      2812531  -10.42%
BenchmarkDecodeNRGBAGradient     12341520     10971680  -11.10%
BenchmarkDecodeNRGBAOpaque       10740780      9612455  -10.51%
BenchmarkDecodePaletted           1819535      1818913   -0.03%
BenchmarkDecodeRGB                8974695      8178070   -8.88%

R=rsc
CC=golang-dev
https://golang.org/cl/6243061
2012-05-30 21:38:46 +10:00
Alex Brainman
994cdcea18 runtime: disable new TestCrashHandle on freebsd to fix build
R=golang-dev
CC=golang-dev
https://golang.org/cl/6256069
2012-05-30 16:41:15 +10:00
Rémy Oudompheng
348087877c runtime: do not unset the special bit after finalization.
A block with finalizer might also be profiled. The special bit
is needed to unregister the block from the profile. It will be
unset only when the block is freed.

Fixes #3668.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/6249066
2012-05-30 08:04:11 +02:00
Andrew Balholm
4e0749a478 exp/html: Convert \r and \r\n to \n when tokenizing
Also escape "\r" as "&#13;" when rendering HTML.

Pass 2 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6260046
2012-05-30 15:50:12 +10:00
Alex Brainman
afe0e97aa6 runtime: handle windows exceptions, even in cgo programs
Fixes #3543.

R=golang-dev, kardianos, rsc
CC=golang-dev, hectorchu, vcc.163
https://golang.org/cl/6245063
2012-05-30 15:10:54 +10:00
Nigel Tao
034fa90dc1 exp/html: add some tokenizer and parser benchmarks.
$GOROOT/src/pkg/exp/html/testdata/go1.html is an execution of the
$GOROOT/doc/go1.html template by godoc.

Sample numbers on my linux,amd64 desktop:
BenchmarkParser	     500	   4699198 ns/op	  16.63 MB/s
--- BENCH: BenchmarkParser
        parse_test.go:409: 1 iterations, 14653 mallocs per iteration
        parse_test.go:409: 100 iterations, 14651 mallocs per iteration
        parse_test.go:409: 500 iterations, 14651 mallocs per iteration
BenchmarkRawLevelTokenizer	    2000	    904957 ns/op	  86.37 MB/s
--- BENCH: BenchmarkRawLevelTokenizer
        token_test.go:657: 1 iterations, 28 mallocs per iteration
        token_test.go:657: 100 iterations, 28 mallocs per iteration
        token_test.go:657: 2000 iterations, 28 mallocs per iteration
BenchmarkLowLevelTokenizer	    2000	   1134300 ns/op	  68.91 MB/s
--- BENCH: BenchmarkLowLevelTokenizer
        token_test.go:657: 1 iterations, 41 mallocs per iteration
        token_test.go:657: 100 iterations, 41 mallocs per iteration
        token_test.go:657: 2000 iterations, 41 mallocs per iteration
BenchmarkHighLevelTokenizer	    1000	   2096179 ns/op	  37.29 MB/s
--- BENCH: BenchmarkHighLevelTokenizer
        token_test.go:657: 1 iterations, 6616 mallocs per iteration
        token_test.go:657: 100 iterations, 6616 mallocs per iteration
        token_test.go:657: 1000 iterations, 6616 mallocs per iteration

R=rsc
CC=andybalholm, golang-dev, r
https://golang.org/cl/6257067
2012-05-30 13:00:32 +10:00
Brad Fitzpatrick
397b687324 net: skip UnixShutdown test on windows
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6259052
2012-05-29 15:46:07 -07:00
Rémy Oudompheng
0ce90459e8 net: add CloseRead, CloseWrite methods to UnixConn.
Fixes #3345.

R=golang-dev, r, rsc, dave
CC=golang-dev, remy
https://golang.org/cl/6214061
2012-05-30 00:08:58 +02:00
Rob Pike
53bc19442d fmt: speed up 10-20%
The check for Stringer etc. can only fire if the test is not a builtin, so avoid
the expensive check if we know there's no chance.
Also put in a fast path for pad, which saves a more modest amount.

benchmark                      old ns/op    new ns/op    delta
BenchmarkSprintfEmpty                148          152   +2.70%
BenchmarkSprintfString               585          497  -15.04%
BenchmarkSprintfInt                  441          396  -10.20%
BenchmarkSprintfIntInt               718          603  -16.02%
BenchmarkSprintfPrefixedInt          676          621   -8.14%
BenchmarkSprintfFloat               1003          953   -4.99%
BenchmarkManyArgs                   2945         2312  -21.49%
BenchmarkScanInts                1704152      1734441   +1.78%
BenchmarkScanRecursiveInt        1837397      1828920   -0.46%

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6245068
2012-05-29 15:08:08 -07:00
Russ Cox
d61707f490 encoding/json: add round trip test in Unmarshal
Also convert table to use tagged literal.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6258061
2012-05-29 18:02:40 -04:00
Brad Fitzpatrick
253d7f0460 net/http: better comment in hasToken
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6249065
2012-05-29 14:27:07 -07:00
Peter Kleiweg
2d1fa08967 Emacs go-mode: don't indent the inside of strings.
Two fixes for indentation problems:

1. Properly recognize multi-line strings. These start with `, not ".

2. Don't indent a line if the beginning of the line is the end of a multi-line string. This happened for instance when inserting a closing bracket after a multi-line string.

R=sameer
CC=golang-dev
https://golang.org/cl/6157044
2012-05-29 16:30:06 -04:00
Robert Griesemer
bd7c626348 exp/types: properly read dotted identifiers
Fixes #3682.

R=rsc
CC=golang-dev
https://golang.org/cl/6256067
2012-05-29 13:15:13 -07:00
Brad Fitzpatrick
12b2022a3b net/http: flush server response gracefully when ignoring request body
This prevents clients from seeing RSTs and missing the response
body.

TCP stacks vary. The included test failed on Darwin before but
passed on Linux.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6256066
2012-05-29 12:40:13 -07:00
Russ Cox
c1b53d43e8 merge unexpected branch 2012-05-29 14:37:41 -04:00
Dmitriy Vyukov
a0efca84e6 time: fix deadlock in Sleep(0)
See time/sleep_test.go for repro.

R=golang-dev, r, rsc
CC=golang-dev, patrick.allen.higgins
https://golang.org/cl/6250072
2012-05-29 22:30:56 +04:00
Brad Fitzpatrick
93fe8c0c93 database/sql: use driver.ColumnConverter everywhere consistently
It was only being used for (*Stmt).Exec, not Query, and not for
the same two methods on *DB.

This unifies (*Stmt).Exec's old inline code into the old
subsetArgs function, renaming it in the process (changing the
old word "subset" to "driver", mostly converted earlier)

Fixes #3640

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6258045
2012-05-29 11:09:09 -07:00
Russ Cox
6dbaa206fb runtime: replace runtime·rnd function with ROUND macro
It's sad to introduce a new macro, but rnd shows up consistently
in profiles, and the function call overwhelms the two arithmetic
instructions it performs.

R=r
CC=golang-dev
https://golang.org/cl/6260051
2012-05-29 14:02:29 -04:00
Rob Pike
90d59c5861 test/bench/shootout/timing.log: update after recent compiler changes
Moving panic out of line speeds up fannkuch almost a factor of two.
Changes to bitwhacking code affect mandelbrot badly.

R=golang-dev, bradfitz, rsc, r
CC=golang-dev
https://golang.org/cl/6258056
2012-05-29 11:01:50 -07:00
Russ Cox
95ae5c180e exp/types: disable test
It's broken and seems to be exp/types's fault.

Update #3682.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6243068
2012-05-29 13:33:37 -04:00
Joel Sing
fb32d60cd1 runtime: make go work on netbsd/386
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6254055
2012-05-30 02:52:50 +10:00
Mikio Hara
8c8ab0552c net: fix comment on FileListener
R=rsc
CC=golang-dev
https://golang.org/cl/6242067
2012-05-30 01:52:50 +09:00
Russ Cox
992a11b88b crypto: housekeeping
Rename _Block to block, don't bother making it compute count.
Add benchmarks.

R=agl, agl
CC=golang-dev
https://golang.org/cl/6243053
2012-05-29 12:45:40 -04:00