1
0
mirror of https://github.com/golang/go synced 2024-10-04 08:41:21 -06:00
Commit Graph

6049 Commits

Author SHA1 Message Date
Joel Sing
622ace8ffe net: fix botched cgo netbsd merge
Fix botched cgo_netbsd.go merge and remove redundant +build directive.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6282048
2012-06-05 02:12:23 +10:00
Joel Sing
5131deeeb2 cgo: enable cgo on netbsd/386 and netbsd/amd64
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6261056
2012-06-05 01:43:04 +10:00
Benny Siegert
677cdb800d syscall: use pipe instead of pipe2 on NetBSD
pipe2 is equivalent to pipe with flags set to 0.
However, pipe2 was only added recently. Using pipe
instead improves compatibility with NetBSD 5.

R=jsing
CC=golang-dev
https://golang.org/cl/6268045
2012-06-05 01:29:34 +10:00
Brad Fitzpatrick
afeaf554aa net/http: add new Server benchmark
The new BenchmarkServer avoids profiling the client code
by running it in a child process.

R=rsc
CC=golang-dev
https://golang.org/cl/6260053
2012-06-04 08:04:40 -07:00
Brad Fitzpatrick
6e3d87f315 net/textproto: add benchmark, cleanup, update comment
The cleanup also makes it ~5% faster, but that's
not the point of this CL.

Optimizations can come in future CLs.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6286043
2012-06-04 07:18:06 -07:00
Brad Fitzpatrick
6b31508e3d net/http: simplify ParseHTTPVersion
Removes code. No need for atoi helper.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6285045
2012-06-04 07:06:05 -07:00
Brad Fitzpatrick
290115fdf4 net/http: change a Del to delete
No need to fix case of "Host" string literal.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6278049
2012-06-03 22:40:16 -07:00
Mikio Hara
24075d33a5 path/filepath: fix test
Make it possible to run test over symlinked GOROOT.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6268046
2012-06-04 09:57:03 +09:00
Russ Cox
a76c8b2430 time: make Format 2.7x faster
benchmark             old ns/op    new ns/op    delta
BenchmarkFormat            2495          937  -62.44%
BenchmarkFormatNow         2308          889  -61.48%

Update #3679.

R=r
CC=golang-dev
https://golang.org/cl/6278047
2012-06-03 11:08:17 -04:00
Joel Sing
eb4138f481 net: move cgo address info flags to per-platform files
Move address info flags to per-platform files. This is needed to
enable cgo on NetBSD (and later OpenBSD), as some of the currently
used AI_* defines do not exist on these platforms.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6250075
2012-06-03 23:54:14 +10:00
Alex Brainman
8801402940 syscall: correct Win32finddata definition
Fixes #3685.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6261053
2012-06-03 19:27:17 +10:00
Luuk van Dijk
40af78c19e cmd/gc: inline slice[arr,str] in the frontend (mostly).
R=rsc, ality, rogpeppe, minux.ma, dave
CC=golang-dev
https://golang.org/cl/5966075
2012-06-02 22:50:57 -04:00
Russ Cox
192550592a exp/html/atom: faster Lookup with smaller tables
Use perfect cuckoo hash, to avoid binary search.
Define Atom bits as offset+len in long string instead
of enumeration, to avoid string headers.

Before: 1909 string bytes + 6060 tables = 7969 total data
After: 1406 string bytes + 2048 tables = 3454 total data

benchmark          old ns/op    new ns/op    delta
BenchmarkLookup        83878        64681  -22.89%

R=nigeltao, r
CC=golang-dev
https://golang.org/cl/6262051
2012-06-02 22:43:11 -04:00
Shenghou Ma
911f802b37 syscall: fix 32-bit uid calls
16-bit uid calls are not always supported in newer kernels.

R=dave, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6279047
2012-06-03 06:49:57 +08:00
Shenghou Ma
e8265f18e6 runtime: remove unnecessary macros in vlop_arm.s
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6270045
2012-06-03 04:03:09 +08:00
Shenghou Ma
d186d07eda cmd/5a, cmd/5l, math: add CLZ instruction for ARM
Supported in ARMv5 and above.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6284043
2012-06-03 03:08:49 +08:00
Jan Ziak
65e61d5770 runtime: add (unused for now) gc field to type information
R=rsc
CC=golang-dev
https://golang.org/cl/6255074
2012-06-02 14:02:44 -04:00
Charles L. Dorian
322057cbfc math: amd64 versions of Ceil, Floor and Trunc
Ceil  to 4.81 from 20.6 ns/op
Floor to 4.37 from 13.5 ns/op
Trunc to 3.97 from 14.3 ns/op
Also changed three MOVSDs to MOVAPDs in log_amd64.s

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/6262048
2012-06-02 13:06:12 -04:00
Jan Mercl
2b57a87678 path/filepath: implement documented SkipDir behavior
Currently walk() doesn't check for err == SkipDir when iterating
a directory list, but such promise is made in the docs for WalkFunc.

Fixes #3486.

R=rsc, r
CC=golang-dev
https://golang.org/cl/6257059
2012-06-02 13:00:09 -04:00
Rob Pike
0e45890c8b text/template/parse: restore the goroutine
To avoid goroutines during init, the nextItem function was a
clever workaround. Now that init goroutines are permitted,
restore the original, simpler design.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6282043
2012-06-01 18:34:14 -07:00
Robert Griesemer
a04d4f02a4 go/parser: ~15% faster parsing
- only compute current line position if needed
  (i.e., if a comment is present)

- added benchmark

benchmark         old ns/op    new ns/op    delta
BenchmarkParse     10902990      9313330  -14.58%

benchmark          old MB/s     new MB/s  speedup
BenchmarkParse         5.31         6.22    1.17x

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6270043
2012-06-01 16:27:49 -07:00
Nigel Tao
d2a6098e9c exp/html/atom: faster, hash-based lookup.
exp/html/atom benchmark:
benchmark          old ns/op    new ns/op    delta
BenchmarkLookup       199226        80770  -59.46%

exp/html benchmark:
benchmark                      old ns/op    new ns/op    delta
BenchmarkParser                  4864890      4510834   -7.28%
BenchmarkHighLevelTokenizer      2209192      1969684  -10.84%
benchmark                       old MB/s     new MB/s  speedup
BenchmarkParser                    16.07        17.33    1.08x
BenchmarkHighLevelTokenizer        35.38        39.68    1.12x

R=r
CC=golang-dev
https://golang.org/cl/6261054
2012-06-01 09:36:05 +10:00
Rémy Oudompheng
baf91c313f runtime: lower memory overhead of heap profiling.
The previous code was preparing arrays of entries that would be
filled if there was one entry every 128 bytes. Moving to a 4096
byte interval reduces the overhead per megabyte of address space
to 2kB from 64kB (on 64-bit systems).
The performance impact will be negative for very small MemProfileRate.

test/bench/garbage/tree2 -heapsize 800000000 (default memprofilerate)
Before: mprof 65993056 bytes (1664 bucketmem + 65991392 addrmem)
After:  mprof  1989984 bytes (1680 bucketmem +  1988304 addrmem)

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/6257069
2012-05-31 23:30:55 +02:00
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
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
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
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
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
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
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
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