]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agocompress/flate: fix overflow on 2GB input. Reset hashOffset every 16 MB.
Ivan Krasin [Wed, 30 May 2012 20:08:38 +0000 (16:08 -0400)]
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

12 years agogo-mode: Works for both GNU-Emacs and XEmacs-21.5
Mats Lidell [Wed, 30 May 2012 20:04:29 +0000 (16:04 -0400)]
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

12 years agotest/bench/shootout: more speedups
Rob Pike [Wed, 30 May 2012 19:31:28 +0000 (12:31 -0700)]
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

12 years agocmd/6g: avoid MOVSD between registers
Russ Cox [Wed, 30 May 2012 18:41:19 +0000 (14:41 -0400)]
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

12 years agoshootout: make mandelbrot.go more like mandelbrot.c
Russ Cox [Wed, 30 May 2012 18:40:59 +0000 (14:40 -0400)]
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

12 years agoA+C: add Mats Lidell. He signed the agreement with the Sweden email
Sameer Ajmani [Wed, 30 May 2012 18:38:40 +0000 (14:38 -0400)]
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

12 years ago misc/emacs: Use patch output of gofmt instead of replacing the buffer.
Jean-Marc Eurin [Wed, 30 May 2012 18:18:58 +0000 (14:18 -0400)]
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

12 years agotest/bench/shootout/timing.log: mandelbrot is restored
Rob Pike [Wed, 30 May 2012 17:35:47 +0000 (10:35 -0700)]
test/bench/shootout/timing.log: mandelbrot is restored

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6259054

12 years agoruntime: always initialise procid on netbsd
Joel Sing [Wed, 30 May 2012 17:27:04 +0000 (03:27 +1000)]
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

12 years agoruntime: update field types in preparation for GC changes
Jan Ziak [Wed, 30 May 2012 17:07:52 +0000 (13:07 -0400)]
runtime: update field types in preparation for GC changes

R=rsc, remyoudompheng, minux.ma, ality
CC=golang-dev
https://golang.org/cl/6242061

12 years agocmd/ld: increase number of ELF sections
Joel Sing [Wed, 30 May 2012 17:06:38 +0000 (03:06 +1000)]
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

12 years agoruntime: hide symbol table from garbage collector
Jan Ziak [Wed, 30 May 2012 17:04:48 +0000 (13:04 -0400)]
runtime: hide symbol table from garbage collector

R=rsc
CC=golang-dev
https://golang.org/cl/6243059

12 years agoexp/locale/collate: avoid double building in maketables.go. Also added check.
Marcel van Lohuizen [Wed, 30 May 2012 15:47:56 +0000 (17:47 +0200)]
exp/locale/collate: avoid double building in maketables.go.  Also added check.

R=r
CC=golang-dev
https://golang.org/cl/6202063

12 years agotest/bench/go1: add mandelbrot for floating point
Russ Cox [Wed, 30 May 2012 14:26:59 +0000 (10:26 -0400)]
test/bench/go1: add mandelbrot for floating point

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6244063

12 years agocmd/6g: change sbop swap logic
Russ Cox [Wed, 30 May 2012 14:22:33 +0000 (10:22 -0400)]
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

12 years agoimage/png: optimize paeth some more.
Nigel Tao [Wed, 30 May 2012 11:38:46 +0000 (21:38 +1000)]
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

12 years agoruntime: disable new TestCrashHandle on freebsd to fix build
Alex Brainman [Wed, 30 May 2012 06:41:15 +0000 (16:41 +1000)]
runtime: disable new TestCrashHandle on freebsd to fix build

R=golang-dev
CC=golang-dev
https://golang.org/cl/6256069

12 years agoruntime: do not unset the special bit after finalization.
Rémy Oudompheng [Wed, 30 May 2012 06:04:11 +0000 (08:04 +0200)]
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

12 years agoexp/html: Convert \r and \r\n to \n when tokenizing
Andrew Balholm [Wed, 30 May 2012 05:50:12 +0000 (15:50 +1000)]
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

12 years agoruntime: handle windows exceptions, even in cgo programs
Alex Brainman [Wed, 30 May 2012 05:10:54 +0000 (15:10 +1000)]
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

12 years agoexp/html: add some tokenizer and parser benchmarks.
Nigel Tao [Wed, 30 May 2012 03:00:32 +0000 (13:00 +1000)]
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

12 years agonet: skip UnixShutdown test on windows
Brad Fitzpatrick [Tue, 29 May 2012 22:46:07 +0000 (15:46 -0700)]
net: skip UnixShutdown test on windows

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6259052

12 years agonet: add CloseRead, CloseWrite methods to UnixConn.
Rémy Oudompheng [Tue, 29 May 2012 22:08:58 +0000 (00:08 +0200)]
net: add CloseRead, CloseWrite methods to UnixConn.

Fixes #3345.

R=golang-dev, r, rsc, dave
CC=golang-dev, remy
https://golang.org/cl/6214061

12 years agofmt: speed up 10-20%
Rob Pike [Tue, 29 May 2012 22:08:08 +0000 (15:08 -0700)]
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

12 years agoencoding/json: add round trip test in Unmarshal
Russ Cox [Tue, 29 May 2012 22:02:40 +0000 (18:02 -0400)]
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

12 years agonet/http: better comment in hasToken
Brad Fitzpatrick [Tue, 29 May 2012 21:27:07 +0000 (14:27 -0700)]
net/http: better comment in hasToken

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6249065

12 years agoEmacs go-mode: don't indent the inside of strings.
Peter Kleiweg [Tue, 29 May 2012 20:30:06 +0000 (16:30 -0400)]
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

12 years agoexp/types: properly read dotted identifiers
Robert Griesemer [Tue, 29 May 2012 20:15:13 +0000 (13:15 -0700)]
exp/types: properly read dotted identifiers

Fixes #3682.

R=rsc
CC=golang-dev
https://golang.org/cl/6256067

12 years agonet/http: flush server response gracefully when ignoring request body
Brad Fitzpatrick [Tue, 29 May 2012 19:40:13 +0000 (12:40 -0700)]
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

12 years agomerge unexpected branch
Russ Cox [Tue, 29 May 2012 18:37:41 +0000 (14:37 -0400)]
merge unexpected branch

12 years agotime: fix deadlock in Sleep(0)
Dmitriy Vyukov [Tue, 29 May 2012 18:30:56 +0000 (22:30 +0400)]
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

12 years agodatabase/sql: use driver.ColumnConverter everywhere consistently
Brad Fitzpatrick [Tue, 29 May 2012 18:09:09 +0000 (11:09 -0700)]
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

12 years agoruntime: replace runtime·rnd function with ROUND macro
Russ Cox [Tue, 29 May 2012 18:02:29 +0000 (14:02 -0400)]
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

12 years agotest/bench/shootout/timing.log: update after recent compiler changes
Rob Pike [Tue, 29 May 2012 18:01:50 +0000 (11:01 -0700)]
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

12 years agoexp/types: disable test
Russ Cox [Tue, 29 May 2012 17:33:37 +0000 (13:33 -0400)]
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

12 years agoruntime: make go work on netbsd/386
Joel Sing [Tue, 29 May 2012 16:52:50 +0000 (02:52 +1000)]
runtime: make go work on netbsd/386

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6254055

12 years agonet: fix comment on FileListener
Mikio Hara [Tue, 29 May 2012 16:52:50 +0000 (01:52 +0900)]
net: fix comment on FileListener

R=rsc
CC=golang-dev
https://golang.org/cl/6242067

12 years agocrypto: housekeeping
Russ Cox [Tue, 29 May 2012 16:45:40 +0000 (12:45 -0400)]
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

12 years agoundo CL 6248054 / 0f418a63cdf9
Mikio Hara [Tue, 29 May 2012 16:42:36 +0000 (01:42 +0900)]
undo CL 6248054 / 0f418a63cdf9

breaks public API document style

««« original CL description
net: fix comment on FileListener

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6248054
»»»

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6242066

12 years agoEmacs go-mode: fix Emacs freeze-up when copy/pasting from string or comment.
Peter Kleiweg [Tue, 29 May 2012 16:40:12 +0000 (12:40 -0400)]
Emacs go-mode: fix Emacs freeze-up when copy/pasting from string or comment.

Fixes #3509.
Fixes #2767.

R=golang-dev, sameer
CC=golang-dev
https://golang.org/cl/6139066

12 years agocmd/6l: Fixes for 64-bit Plan 9
Akshat Kumar [Tue, 29 May 2012 16:32:42 +0000 (12:32 -0400)]
cmd/6l: Fixes for 64-bit Plan 9

Plan 9 versions for amd64 have 2 megabyte pages.
This also fixes the logic for 32-bit vs 64-bit Plan 9,
making 64-bit the default, and adds logic to generate
a symbols table.

R=golang-dev, rsc, rminnich, ality, 0intro
CC=golang-dev, john
https://golang.org/cl/6218046

12 years agocmd/6g, cmd/8g: move panicindex calls out of line
Russ Cox [Tue, 29 May 2012 16:09:27 +0000 (12:09 -0400)]
cmd/6g, cmd/8g: move panicindex calls out of line

The old code generated for a bounds check was
                CMP
                JLT ok
                CALL panicindex
        ok:
                ...

The new code is (once the linker finishes with it):
                CMP
                JGE panic
                ...
        panic:
                CALL panicindex

which moves the calls out of line, putting more useful
code in each cache line.  This matters especially in tight
loops, such as in Fannkuch.  The benefit is more modest
elsewhere, but real.

From test/bench/go1, amd64:

benchmark                old ns/op    new ns/op    delta
BenchmarkBinaryTree17   6096092000   6088808000   -0.12%
BenchmarkFannkuch11     6151404000   4020463000  -34.64%
BenchmarkGobDecode        28990050     28894630   -0.33%
BenchmarkGobEncode        12406310     12136730   -2.17%
BenchmarkGzip               179923       179903   -0.01%
BenchmarkGunzip              11219        11130   -0.79%
BenchmarkJSONEncode       86429350     86515900   +0.10%
BenchmarkJSONDecode      334593800    315728400   -5.64%
BenchmarkRevcomp25M     1219763000   1180767000   -3.20%
BenchmarkTemplate        492947600    483646800   -1.89%

And 386:

benchmark                old ns/op    new ns/op    delta
BenchmarkBinaryTree17   6354902000   6243000000   -1.76%
BenchmarkFannkuch11     8043769000   7326965000   -8.91%
BenchmarkGobDecode        19010800     18941230   -0.37%
BenchmarkGobEncode        14077500     13792460   -2.02%
BenchmarkGzip               194087       193619   -0.24%
BenchmarkGunzip              12495        12457   -0.30%
BenchmarkJSONEncode      125636400    125451400   -0.15%
BenchmarkJSONDecode      696648600    685032800   -1.67%
BenchmarkRevcomp25M     2058088000   2052545000   -0.27%
BenchmarkTemplate        602140000    589876800   -2.04%

To implement this, two new instruction forms:

        JLT target      // same as always
        JLT $0, target  // branch expected not taken
        JLT $1, target  // branch expected taken

The linker could also emit the prediction prefixes, but it
does not: expected taken branches are reversed so that the
expected case is not taken (as in example above), and
the default expectaton for such a jump is not taken
already.

R=golang-dev, gri, r, dave
CC=golang-dev
https://golang.org/cl/6248049

12 years agoA+C: Peter Kleiweg (individual CLA)
Sameer Ajmani [Tue, 29 May 2012 15:12:31 +0000 (11:12 -0400)]
A+C: Peter Kleiweg (individual CLA)

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6260049

12 years agoexp/html: implement Noah's Ark clause
Andrew Balholm [Tue, 29 May 2012 03:39:54 +0000 (13:39 +1000)]
exp/html: implement Noah's Ark clause

Implement the (3-per-family) Noah's Ark clause (i.e. don't put
more than three identical elements on the list of active formatting
elements.

Also, when running tests, sort attributes by name before dumping
them.

Pass 4 additional tests with Noah's Ark clause (including one
that needs attributes to be sorted).

Pass 5 additional, unrelated tests because of sorting attributes.

R=nigeltao, rsc
CC=golang-dev
https://golang.org/cl/6247056

12 years agonet: fix comment on FileListener
Mikio Hara [Mon, 28 May 2012 21:13:56 +0000 (06:13 +0900)]
net: fix comment on FileListener

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6248054

12 years agonet: make parsePort as a function
Mikio Hara [Mon, 28 May 2012 21:12:06 +0000 (06:12 +0900)]
net: make parsePort as a function

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6256059

12 years agonet/http: avoid fmt.Fprintf in Header.WriteSubset
Brad Fitzpatrick [Mon, 28 May 2012 18:26:45 +0000 (11:26 -0700)]
net/http: avoid fmt.Fprintf in Header.WriteSubset

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/6242062

12 years agonet/http: avoid a bunch of unnecessary CanonicalHeaderKey calls
Brad Fitzpatrick [Mon, 28 May 2012 18:07:24 +0000 (11:07 -0700)]
net/http: avoid a bunch of unnecessary CanonicalHeaderKey calls

CanonicalHeaderKey didn't allocate, but it did use unnecessary
CPU in the hot path, deciding it didn't need to allocate.

I considered using constants for all these common header keys
but I didn't think it would be prettier. "Content-Length" looks
better than contentLength or hdrContentLength, etc.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6255053

12 years agonet/http: speed up ServeMux when no patterns contain hostnames
Brad Fitzpatrick [Mon, 28 May 2012 17:58:49 +0000 (10:58 -0700)]
net/http: speed up ServeMux when no patterns contain hostnames

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6248053

12 years agonet/http: correct and faster hasToken
Brad Fitzpatrick [Mon, 28 May 2012 17:55:39 +0000 (10:55 -0700)]
net/http: correct and faster hasToken

Fixes #3535

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6245060

12 years agonet/http: reuse http proxy connections for different http requests
Alexey Borzenkov [Mon, 28 May 2012 17:46:51 +0000 (10:46 -0700)]
net/http: reuse http proxy connections for different http requests

Comment on cache keys above connectMethod says "http to proxy, http
anywhere after that", however in reality target address was always
included, which prevented http requests to different target
addresses to reuse the same http proxy connection.

R=golang-dev, r, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5901064

12 years agosyscall: simplify text returned by Errno.Error() when FormatMessage fails
Alex Brainman [Sun, 27 May 2012 08:57:16 +0000 (18:57 +1000)]
syscall: simplify text returned by Errno.Error() when FormatMessage fails

Fixes #3623.

R=golang-dev, bsiegert, rsc
CC=golang-dev
https://golang.org/cl/6218072

12 years agonet/rpc: improve response reading logic
Alexey Borzenkov [Sat, 26 May 2012 21:27:36 +0000 (14:27 -0700)]
net/rpc: improve response reading logic

CL 5956051 introduced too many call != nil checks, so
attempt to improve this by splitting logic into three
distinct parts.

R=r
CC=golang-dev
https://golang.org/cl/6248048

12 years agoimage/png: optimize the paeth filter implementation.
Nigel Tao [Fri, 25 May 2012 04:08:51 +0000 (14:08 +1000)]
image/png: optimize the paeth filter implementation.

image/png benchmarks:
benchmark                       old ns/op    new ns/op    delta
BenchmarkPaeth                         10            7  -29.21%
BenchmarkDecodeGray               2381745      2241620   -5.88%
BenchmarkDecodeNRGBAGradient      9535555      8835100   -7.35%
BenchmarkDecodeNRGBAOpaque        8189590      7611865   -7.05%
BenchmarkDecodePaletted           1300688      1301940   +0.10%
BenchmarkDecodeRGB                6760146      6317082   -6.55%
BenchmarkEncodePaletted           6048596      6122666   +1.22%
BenchmarkEncodeRGBOpaque         18891140     19474230   +3.09%
BenchmarkEncodeRGBA              78945350     78552600   -0.50%

Wall time for Denis Cheremisov's PNG-decoding program given in
https://groups.google.com/group/golang-nuts/browse_thread/thread/22aa8a05040fdd49
Before: 2.25s
After:  2.27s
Delta:  +1%

The same program, but with a different PNG input file
(http://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png)
and only 100 iterations instead of 1000
Before: 4.78s
After:  4.42s
Delta:  -8%

R=rsc
CC=golang-dev
https://golang.org/cl/6242056

12 years agocmd/8c: better fix for 64-bit register smash
Russ Cox [Fri, 25 May 2012 03:36:26 +0000 (23:36 -0400)]
cmd/8c: better fix for 64-bit register smash

Ken pointed out that CL 5998043 was ugly code.
This should be better.

Fixes #3501.

R=ken2
CC=golang-dev
https://golang.org/cl/6258049

12 years agocmd/gc: fix parallel assignment in range
Russ Cox [Fri, 25 May 2012 03:05:36 +0000 (23:05 -0400)]
cmd/gc: fix parallel assignment in range

for expr1, expr2 = range slice
was assigning to expr1 and expr2 in sequence
instead of in parallel.  Now it assigns in parallel,
as it should.  This matters for things like
for i, x[i] = range slice.

Fixes #3464.

R=ken2
CC=golang-dev
https://golang.org/cl/6252048

12 years agoruntime: handle and test large map values
Russ Cox [Fri, 25 May 2012 02:41:07 +0000 (22:41 -0400)]
runtime: handle and test large map values

This is from CL 5451105 but was dropped from that CL.
See also CL 6137051.

The only change compared to 5451105 is to check for
h != nil in reflect·mapiterinit; allowing use of nil maps
must have happened after that original CL.

Fixes #3573.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/6215078

12 years agomisc/dist: use archive/tar.FileInfoHeader
Brad Fitzpatrick [Fri, 25 May 2012 00:32:25 +0000 (17:32 -0700)]
misc/dist: use archive/tar.FileInfoHeader

Fixes #3299

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6250056

12 years agoexp/html: adjust parseForeignContent to match spec
Andrew Balholm [Fri, 25 May 2012 00:03:59 +0000 (10:03 +1000)]
exp/html: adjust parseForeignContent to match spec

Remove redundant checks for integration points.

Ignore null bytes in text.

Don't break out of foreign content for a <font> tag unless it
has a color, face, or size attribute.

Check for MathML text integration points when breaking out of
foreign content.

Pass two new tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6256045

12 years agohash/adler32: optimize.
Nigel Tao [Thu, 24 May 2012 23:58:38 +0000 (09:58 +1000)]
hash/adler32: optimize.

The bulk of the gains come from hoisting the modulo ops outside of
the inner loop.

Reducing the digest type from 8 bytes to 4 bytes gains another 1% on
the hash/adler32 micro-benchmark.

Benchmarks for $GOOS,$GOARCH = linux,amd64 below.

hash/adler32 benchmark:
benchmark             old ns/op    new ns/op    delta
BenchmarkAdler32KB         1660         1364  -17.83%

image/png benchmark:
benchmark                       old ns/op    new ns/op    delta
BenchmarkDecodeGray               2466909      2425539   -1.68%
BenchmarkDecodeNRGBAGradient      9884500      9751705   -1.34%
BenchmarkDecodeNRGBAOpaque        8511615      8379800   -1.55%
BenchmarkDecodePaletted           1366683      1330677   -2.63%
BenchmarkDecodeRGB                6987496      6884974   -1.47%
BenchmarkEncodePaletted           6292408      6040052   -4.01%
BenchmarkEncodeRGBOpaque         19780680     19178440   -3.04%
BenchmarkEncodeRGBA              80738600     79076800   -2.06%

Wall time for Denis Cheremisov's PNG-decoding program given in
https://groups.google.com/group/golang-nuts/browse_thread/thread/22aa8a05040fdd49
Before: 2.44s
After:  2.26s
Delta:  -7%

R=rsc
CC=golang-dev
https://golang.org/cl/6251044

12 years agostrconv: better documentation for FormatInt, FormatUint.
Robert Griesemer [Thu, 24 May 2012 23:24:39 +0000 (16:24 -0700)]
strconv: better documentation for FormatInt, FormatUint.

Fixes #3580.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6252047

12 years agonet/mail: more liberal parsing of Date headers.
Bill Thiede [Thu, 24 May 2012 23:19:21 +0000 (09:19 +1000)]
net/mail: more liberal parsing of Date headers.
Fixes #3639.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6243045

12 years agoC: Bill Thiede (Google CLA)
David Symonds [Thu, 24 May 2012 23:18:12 +0000 (09:18 +1000)]
C: Bill Thiede (Google CLA)

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6257050

12 years agonet/rpc: fix race condition when request write partially fails
Alexey Borzenkov [Thu, 24 May 2012 23:07:08 +0000 (16:07 -0700)]
net/rpc: fix race condition when request write partially fails

When client fails to write a request is sends caller that error,
however server might have failed to read that request in the mean
time and replied with that error. When client then reads the
response the call would no longer be pending, so call will be nil

Handle this gracefully by discarding such server responses

R=golang-dev, r
CC=golang-dev, rsc
https://golang.org/cl/5956051

12 years agoarchive/tar: fix windows test failure
Brad Fitzpatrick [Thu, 24 May 2012 21:32:18 +0000 (14:32 -0700)]
archive/tar: fix windows test failure

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6249052

12 years agocmd/gc: faster code, mainly for rotate
Russ Cox [Thu, 24 May 2012 21:20:07 +0000 (17:20 -0400)]
cmd/gc: faster code, mainly for rotate

* Eliminate bounds check on known small shifts.
* Rewrite x<<s | x>>(32-s) as a rotate (constant s).
* More aggressive (but still minimal) range analysis.

R=ken, dave, iant
CC=golang-dev
https://golang.org/cl/6209077

12 years agoruntime: fix docs for Caller and Callers
Rob Pike [Thu, 24 May 2012 21:15:43 +0000 (14:15 -0700)]
runtime: fix docs for Caller and Callers
The previous attempt to explain this got it backwards (all the more reason to be
sad we couldn't make the two functions behave the same).

Fixes #3669.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6249051

12 years agoarchive/tar: add FileInfoHeader function
Brad Fitzpatrick [Thu, 24 May 2012 21:10:54 +0000 (14:10 -0700)]
archive/tar: add FileInfoHeader function

Fixes #3295

R=adg, rsc, mike.rosset
CC=golang-dev
https://golang.org/cl/5796073

12 years agoexp/locale/collate: avoid 16-bit math
Russ Cox [Thu, 24 May 2012 18:50:36 +0000 (14:50 -0400)]
exp/locale/collate: avoid 16-bit math

There's no need for the 16-bit arithmetic here,
and it tickles a long-standing compiler bug.
Fix the exp code not to use 16-bit math and
create an explicit test for the compiler bug.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6256048

12 years agocmd/gc: fix small integer bounds check bug
Russ Cox [Thu, 24 May 2012 18:01:39 +0000 (14:01 -0400)]
cmd/gc: fix small integer bounds check bug

R=ken2
CC=golang-dev
https://golang.org/cl/6254046

12 years agospec: clarify evaluation order of "i, x[i] = range ..."
Robert Griesemer [Thu, 24 May 2012 17:59:48 +0000 (10:59 -0700)]
spec: clarify evaluation order of "i, x[i] = range ..."

Part of fix for issue 3464.

R=golang-dev, rsc, mirtchovski, iant, r
CC=golang-dev
https://golang.org/cl/6246045

12 years agogodoc: correctly categorize interface methods, performance tuning
Robert Griesemer [Thu, 24 May 2012 17:56:35 +0000 (10:56 -0700)]
godoc: correctly categorize interface methods, performance tuning

- interface methods appeared under VarDecl in search results
  (long-standing TODO)

- don't walk parts of AST which contain no indexable material
  (minor performance tuning)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6228047

12 years agomath/big: make Rat.Denom() always return a reference
Robert Griesemer [Thu, 24 May 2012 17:49:38 +0000 (10:49 -0700)]
math/big: make Rat.Denom() always return a reference

The documentation says so, but in the case of a normalized
integral Rat, the denominator was a new value. Changed the
internal representation to use an Int to represent the
denominator (with the sign ignored), so a reference to it
can always be returned.

Clarified documentation and added test cases.

Fixes #3521.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6237045

12 years agocmd/6g: peephole fixes/additions
Russ Cox [Thu, 24 May 2012 16:11:32 +0000 (12:11 -0400)]
cmd/6g: peephole fixes/additions

* Shift/rotate by constant doesn't have to stop subprop. (also in 8g)
* Remove redundant MOVLQZX instructions.
* An attempt at issuing loads early.
  Good for 0.5% on a good day, might not be worth keeping.
  Need to understand more about whether the x86
  looks ahead to what loads might be coming up.

R=ken2, ken
CC=golang-dev
https://golang.org/cl/6203091

12 years agocmd/cc: fix uint right shift in constant evaluation
Shenghou Ma [Thu, 24 May 2012 16:08:52 +0000 (00:08 +0800)]
cmd/cc: fix uint right shift in constant evaluation
        Fixes #3664.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6249048

12 years agoruntime: faster GC mark phase
Dmitriy Vyukov [Thu, 24 May 2012 06:55:50 +0000 (10:55 +0400)]
runtime: faster GC mark phase
Also bump MaxGcproc to 8.

benchmark             old ns/op    new ns/op    delta
Parser               3796323000   3763880000   -0.85%
Parser-2             3591752500   3518560250   -2.04%
Parser-4             3423825250   3334955250   -2.60%
Parser-8             3304585500   3267014750   -1.14%
Parser-16            3313615750   3286160500   -0.83%

Tree                  984128500    942501166   -4.23%
Tree-2                932564444    883266222   -5.29%
Tree-4                835831000    799912777   -4.30%
Tree-8                819238500    789717333   -3.73%
Tree-16               880837833    837840055   -5.13%

Tree2                 604698100    579716900   -4.13%
Tree2-2               372414500    356765200   -4.20%
Tree2-4               187488100    177455900   -5.56%
Tree2-8               136315300    102086700  -25.11%
Tree2-16               93725900     76705800  -22.18%

ParserPause           157441210    166202783   +5.56%
ParserPause-2          93842650     85199900   -9.21%
ParserPause-4          56844404     53535684   -5.82%
ParserPause-8          35739446     30767613  -16.15%
ParserPause-16         32718255     27212441  -16.83%

TreePause              29610557     29787725   +0.60%
TreePause-2            24001659     20674421  -13.86%
TreePause-4            15114887     12842781  -15.03%
TreePause-8            13128725     10741747  -22.22%
TreePause-16           16131360     12506901  -22.47%

Tree2Pause           2673350920   2651045280   -0.83%
Tree2Pause-2         1796999200   1709350040   -4.88%
Tree2Pause-4         1163553320   1090706480   -6.67%
Tree2Pause-8          987032520    858916360  -25.11%
Tree2Pause-16         864758560    809567480   -6.81%

ParserLastPause       280537000    289047000   +3.03%
ParserLastPause-2     183030000    166748000   -8.90%
ParserLastPause-4     105817000     91552000  -13.48%
ParserLastPause-8      65127000     53288000  -18.18%
ParserLastPause-16     45258000     38334000  -15.30%

TreeLastPause          45072000     51449000  +12.39%
TreeLastPause-2        39269000     37866000   -3.57%
TreeLastPause-4        23564000     20649000  -12.37%
TreeLastPause-8        20881000     15807000  -24.30%
TreeLastPause-16       23297000     17309000  -25.70%

Tree2LastPause       6046912000   5797120000   -4.13%
Tree2LastPause-2     3724034000   3567592000   -4.20%
Tree2LastPause-4     1874831000   1774524000   -5.65%
Tree2LastPause-8     1363108000   1020809000  -12.79%
Tree2LastPause-16     937208000    767019000  -22.18%

R=rsc, 0xe2.0x9a.0x9b
CC=golang-dev
https://golang.org/cl/6223050

12 years agoexp/html: detect "integration points" in SVG and MathML content
Andrew Balholm [Thu, 24 May 2012 03:46:41 +0000 (13:46 +1000)]
exp/html: detect "integration points" in SVG and MathML content

Detect HTML integration points and MathML text integration points.
At these points, process tokens as HTML, not as foreign content.

Pass 33 more tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6249044

12 years agoflag: include flag name in redefinition panic.
David Symonds [Thu, 24 May 2012 03:42:02 +0000 (13:42 +1000)]
flag: include flag name in redefinition panic.

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/6250043

12 years agoruntime: make go work on netbsd/amd64
Joel Sing [Thu, 24 May 2012 01:33:11 +0000 (11:33 +1000)]
runtime: make go work on netbsd/amd64

R=golang-dev, rsc, devon.odell
CC=golang-dev
https://golang.org/cl/6222044

12 years agoexp/html: update test data
Andrew Balholm [Thu, 24 May 2012 00:35:31 +0000 (10:35 +1000)]
exp/html: update test data

Import updated test data from the WebKit Subversion repository (SVN revision 118111).

Some of the old tests were failing because we were HTML5 compliant, but the tests weren't.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6228049

12 years agoencoding/json: documentation fix
Brad Fitzpatrick [Thu, 24 May 2012 00:18:05 +0000 (17:18 -0700)]
encoding/json: documentation fix

Fixes #3650

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6238046

12 years agogo/parser: resolve all parameter types
Robert Griesemer [Wed, 23 May 2012 23:12:45 +0000 (16:12 -0700)]
go/parser: resolve all parameter types

Fixes #3655.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6213065

12 years agocmd/api: add flag to specify contexts
Brad Fitzpatrick [Wed, 23 May 2012 20:45:53 +0000 (13:45 -0700)]
cmd/api: add flag to specify contexts

I needed this to explore per-GOOS/GOARCH differences in pkg
syscall for a recent CL.  Others may find it useful too.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6236046

12 years agonet/http: fix response Connection: close, close client connections
Brad Fitzpatrick [Wed, 23 May 2012 18:19:38 +0000 (11:19 -0700)]
net/http: fix response Connection: close, close client connections

Fixes #3663
Updates #3540 (fixes it more)
Updates #1967 (fixes it more, re-enables a test)

R=golang-dev, n13m3y3r
CC=golang-dev
https://golang.org/cl/6213064

12 years agogo/parser: minor cleanup
Robert Griesemer [Wed, 23 May 2012 16:37:48 +0000 (09:37 -0700)]
go/parser: minor cleanup

- there is no label scope at package level
- open/close all scopes symmetrically now
  that there is only one parse entry point
  (parseFile)

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6230047

12 years agonet/http: clarify ErrBodyNotAllowed error message
Brad Fitzpatrick [Wed, 23 May 2012 16:31:24 +0000 (09:31 -0700)]
net/http: clarify ErrBodyNotAllowed error message

It's usually due to writing on HEAD requests.

R=golang-dev, rsc, r, r
CC=golang-dev
https://golang.org/cl/6206106

12 years agocmd/ld: fix Linux/ARM build
Shenghou Ma [Wed, 23 May 2012 03:36:24 +0000 (11:36 +0800)]
cmd/ld: fix Linux/ARM build
        CL 5823055 removed a line introduced in Linux/ARM cgo support.
        Because readsym() now returns nil for "$a", "$d" mapping symbols,
        no matter the settings of `needSym', we still have to guard against
        them in ldelf().

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6220073

12 years agosyscall: implement SetsockoptLinger for windows
Alex Brainman [Wed, 23 May 2012 03:05:05 +0000 (13:05 +1000)]
syscall: implement SetsockoptLinger for windows

R=rsc
CC=golang-dev
https://golang.org/cl/6225048

12 years agocmd/api: add api/next.txt
Brad Fitzpatrick [Wed, 23 May 2012 01:41:20 +0000 (18:41 -0700)]
cmd/api: add api/next.txt

This quiets all.bash noise for upcoming features we know about.

The all.bash warnings will now only print for things not in next.txt
(or in next.txt but not in the API).

Once an API is frozen, we rename next.txt to a new frozen file
(like go1.txt)

Fixes #3651

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6218069

12 years agoexp/html: adjust the last few insertion modes to match the spec
Andrew Balholm [Wed, 23 May 2012 01:11:34 +0000 (11:11 +1000)]
exp/html: adjust the last few insertion modes to match the spec

Handle text, comment, and doctype tokens in afterBodyIM, afterAfterBodyIM,
and afterAfterFramesetIM.

Pass three more tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6231043

12 years agomath/big: implement JSON un/marshaling support for Ints
Robert Griesemer [Wed, 23 May 2012 00:20:37 +0000 (17:20 -0700)]
math/big: implement JSON un/marshaling support for Ints

Also: simplified some existing tests.

No support for Rats for now because the precision-preserving
default notation (fractions of the form a/b) is not a valid
JSON value.

Fixes #3657.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6211079

12 years agotext/template: exec should accept interface value as valid.
Ugorji Nwoke [Tue, 22 May 2012 22:21:35 +0000 (15:21 -0700)]
text/template: exec should accept interface value as valid.

Currently, if you pass some data to a template as an interface (e.g. interface{})
and extract that value that value as a parameter for a function, it fails, saying
wrong type.

This is because it is only looking at the interface type, not the interface content.

This CL uses the underlying content as the parameter to the func.

Fixes #3642.

R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/6218052

13 years agocmd/ld, cmd/6l, cmd/8l, cmd/5l: fix hidden/local symbol import for ELF systems
Shenghou Ma [Tue, 22 May 2012 18:32:27 +0000 (02:32 +0800)]
cmd/ld, cmd/6l, cmd/8l, cmd/5l: fix hidden/local symbol import for ELF systems
   Introduce a newsym() to cmd/lib.c to add a symbol but don't add
them to hash table.
   Introduce a new bit flag SHIDDEN and bit mask SMASK to handle hidden
and/or local symbols in ELF symbol tables. Though we still need to order
the symbol table entries correctly.
   Fix for issue 3261 comment #9.
   For CL 5822049.

R=iant, rsc
CC=golang-dev
https://golang.org/cl/5823055

13 years agocmd/ld: take section symbols' value into account for PE
Shenghou Ma [Tue, 22 May 2012 18:27:44 +0000 (02:27 +0800)]
cmd/ld: take section symbols' value into account for PE
    ld -r could generate multiple section symbols for the same section,
but with different values, we have to take that into account.
    Fixes #3322.
    Part of issue 3261.
    For CL 5822049.

R=golang-dev, iant, rsc, iant
CC=golang-dev
https://golang.org/cl/5823059

13 years agosync/atomic: use cas64 to implement {Load,Store,Add}{Uint,Int}64 on Linux/ARM
Shenghou Ma [Tue, 22 May 2012 18:02:01 +0000 (02:02 +0800)]
sync/atomic: use cas64 to implement {Load,Store,Add}{Uint,Int}64 on Linux/ARM
        Now with GOARM=5 our all.bash should pass on ARMv5 systems.
        Fixes #3331.

R=golang-dev, rsc, dvyukov
CC=golang-dev
https://golang.org/cl/6210071

13 years agoruntime: support conditional execution in ARM softfloat
Shenghou Ma [Tue, 22 May 2012 18:00:40 +0000 (02:00 +0800)]
runtime: support conditional execution in ARM softfloat
        Fixes #3638.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6213057

13 years agoundo CL 6112054 / 2eec2501961c
Russ Cox [Tue, 22 May 2012 17:56:40 +0000 (13:56 -0400)]
undo CL 6112054 / 2eec2501961c

Now that we've fixed the Expect: test, this CL should be okay.

««« original CL description
net/http: revert 97d027b3aa68

Revert the following change set:

        changeset:   13018:97d027b3aa68
        user:        Gustavo Niemeyer <gustavo@niemeyer.net>
        date:        Mon Apr 23 22:00:16 2012 -0300
        summary:     net/http: allow clients to disable keep-alive

This broke a test on Windows 64 and somebody else
will have to check.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6112054
»»»

Fixes #3540.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6228046

13 years agounicode: fix comment about variable types
Russ Cox [Tue, 22 May 2012 17:53:57 +0000 (13:53 -0400)]
unicode: fix comment about variable types

In both the web and command line tool,
the comment is shown after the declaration.
But in the code the comment is obviously before.
Make the text not refer to a specific order.

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/6206094

13 years agocmd/gc: export constants in hexadecimal
Jan Ziak [Tue, 22 May 2012 17:53:38 +0000 (13:53 -0400)]
cmd/gc: export constants in hexadecimal

R=golang-dev, r, rsc, iant, remyoudompheng, dave
CC=golang-dev
https://golang.org/cl/6206077

13 years agocrypto/md5: faster inner loop, 3x faster overall
Russ Cox [Tue, 22 May 2012 17:53:27 +0000 (13:53 -0400)]
crypto/md5: faster inner loop, 3x faster overall

The speedup is a combination of unrolling/specializing
the actual code and also making the compiler generate better code.

Go 1.0.1 (size: 1239 code + 320 data = 1559 total)
md5.BenchmarkHash1K   1000000    7178 ns/op  142.64 MB/s
md5.BenchmarkHash8K    200000   56834 ns/op  144.14 MB/s

Partial unroll  (size: 1115 code + 256 data = 1371 total)
md5.BenchmarkHash1K   5000000    2513 ns/op  407.37 MB/s
md5.BenchmarkHash8K    500000   19406 ns/op  422.13 MB/s

Complete unroll  (size: 1900 code + 0 data = 1900 code)
md5.BenchmarkHash1K   5000000    2442 ns/op  419.18 MB/s
md5.BenchmarkHash8K    500000   18957 ns/op  432.13 MB/s

Comparing Go 1.0.1 and the complete unroll (this CL):

benchmark               old MB/s     new MB/s  speedup
md5.BenchmarkHash1K       142.64       419.18    2.94x
md5.BenchmarkHash8K       144.14       432.13    3.00x

On the same machine, 'openssl speed md5' reports 441 MB/s
and 531 MB/s for our two cases, so this CL is at 90% and 80% of
those speeds, which is at least in the right ballpark.
OpenSSL is using carefully engineered assembly, so we are
unlikely to catch up completely.

Measurements on a Mid-2010 MacPro5,1.

R=golang-dev, bradfitz, agl
CC=golang-dev
https://golang.org/cl/6220046