1
0
mirror of https://github.com/golang/go synced 2024-10-03 20:21:22 -06:00
Commit Graph

6979 Commits

Author SHA1 Message Date
Shenghou Ma
e985d5464b time: add note about Parse()'s choice of default year
R=rsc
CC=golang-dev
https://golang.org/cl/7101046
2013-01-19 04:57:31 +08:00
Raph Levien
ebf35167ee compress/flate: Performance improvement for inflate
Decode as much as possible of a Huffman symbol in a single table
lookup (much like the zlib implementation), filling more bits
(conservatively, so we don't consume past the end of the stream)
when the code prefix indicates more bits are needed. This
results in about a 50% performance gain in speed benchmarks.
The following set is benchcmp done on a retina MacBook Pro:

benchmark                            old MB/s     new MB/s  speedup
BenchmarkDecodeDigitsSpeed1e4           28.41        42.79    1.51x
BenchmarkDecodeDigitsSpeed1e5           30.18        47.62    1.58x
BenchmarkDecodeDigitsSpeed1e6           30.81        48.14    1.56x
BenchmarkDecodeDigitsDefault1e4         30.28        44.61    1.47x
BenchmarkDecodeDigitsDefault1e5         32.18        51.94    1.61x
BenchmarkDecodeDigitsDefault1e6         35.57        53.28    1.50x
BenchmarkDecodeDigitsCompress1e4        30.39        44.83    1.48x
BenchmarkDecodeDigitsCompress1e5        33.05        51.64    1.56x
BenchmarkDecodeDigitsCompress1e6        35.69        53.04    1.49x
BenchmarkDecodeTwainSpeed1e4            25.90        43.04    1.66x
BenchmarkDecodeTwainSpeed1e5            29.97        48.19    1.61x
BenchmarkDecodeTwainSpeed1e6            31.36        49.43    1.58x
BenchmarkDecodeTwainDefault1e4          28.79        45.02    1.56x
BenchmarkDecodeTwainDefault1e5          37.12        55.65    1.50x
BenchmarkDecodeTwainDefault1e6          39.28        58.16    1.48x
BenchmarkDecodeTwainCompress1e4         28.64        44.90    1.57x
BenchmarkDecodeTwainCompress1e5         37.40        55.98    1.50x
BenchmarkDecodeTwainCompress1e6         39.35        58.06    1.48x

R=rsc, dave, minux.ma, bradfitz, nigeltao
CC=golang-dev
https://golang.org/cl/6872063
2013-01-18 15:09:42 -05:00
Alex Brainman
e0aa26a427 time: Sleep does better job then runtime.Gosched in TestAfterStress
for slow windows-386 builder

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/7128053
2013-01-18 15:31:01 +11:00
Andrew Gerrand
e19cdc651c testing: allow examples to pass (fix build)
R=golang-dev
CC=golang-dev
https://golang.org/cl/7132050
2013-01-18 12:25:41 +11:00
Andrew Gerrand
c022943449 html/template: remove noescape support
This was never documented or properly implemented.

Fixes #3528.

R=mikesamuel, rsc
CC=golang-dev
https://golang.org/cl/7142048
2013-01-18 10:30:12 +11:00
Andrew Gerrand
5bd5ed2b57 testing: catch panicking example and report, just like tests
Fixes #4670.

R=rsc
CC=golang-dev
https://golang.org/cl/7148043
2013-01-18 10:28:18 +11:00
Shenghou Ma
d46d0f15a7 all: remove exec bit on files
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7128048
2013-01-18 02:41:17 +08:00
Shenghou Ma
40b3758864 os: use SameFile in TestStartProcess
Fixes #4650.

R=golang-dev, bradfitz, alex.brainman
CC=golang-dev
https://golang.org/cl/7085048
2013-01-17 18:48:11 +08:00
Shenghou Ma
1e095b7622 testing: introduce (*B).ReportAllocs()
Calling it will show memory allocation statistics for that
single benchmark (if -test.benchmem is not provided)

R=golang-dev, rsc, kevlar, bradfitz
CC=golang-dev
https://golang.org/cl/7027046
2013-01-17 18:45:49 +08:00
Volker Dobler
44ff17e664 time: add Timer.Reset
Fixes #4412.

R=adg, rsc, rogpeppe, andrewdg, bradfitz
CC=golang-dev
https://golang.org/cl/7086050
2013-01-17 14:41:53 +11:00
Andrew Balholm
55740f763f exp/html: remove "INCOMPLETE" comment
I think that the parser is complete enough to take that warning out.
It passes the test suite.
There may be incompatible API changes, but being in the exp directory
is warning enough for that.

R=nigeltao
CC=golang-dev
https://golang.org/cl/7131050
2013-01-17 12:06:04 +11:00
Robert Griesemer
5a4a197d7b go/types: correct result type for append (bug fix)
Rewrote existing code to prevent similar mistakes.

R=adonovan
CC=golang-dev
https://golang.org/cl/7129046
2013-01-16 15:08:19 -08:00
Matthew Dempsky
1a03580ef1 net/http: Serve creates service goroutines, not service threads
R=bradfitz
CC=golang-dev
https://golang.org/cl/7132045
2013-01-16 14:05:41 -08:00
Brad Fitzpatrick
3b73aaafdc net/http: fix racy test
We need to wait for the handler to actually finish running,
not almost be done running.

This was always a bug, but now that handler output is buffered
it shows up easily on GOMAXPROCS >1 systems.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7109043
2013-01-15 09:13:05 -08:00
Mikio Hara
6d725e97e3 net: simplify ListenMulticastUDP
R=rsc, iant, dave
CC=golang-dev
https://golang.org/cl/6999053
2013-01-15 08:53:12 +09:00
Mikio Hara
c241f696f8 syscall: simplify socket control messages
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7016044
2013-01-15 08:52:22 +09:00
Robert Griesemer
0822a62cb7 go/types: set type of lhs ident in type switch guards
(bug fix)

R=adonovan
CC=golang-dev
https://golang.org/cl/7098059
2013-01-14 15:25:42 -08:00
Robert Griesemer
5e5c0a9fbb go/types: various minor fixes
- always set the Pkg field in QualifiedIdents
- call Context.Ident for all identifiers in the AST that denote
  a types.Object (bug fix)
- added test that Context.Ident is called for all such identifiers

R=adonovan
CC=golang-dev
https://golang.org/cl/7101054
2013-01-14 15:19:32 -08:00
Brad Fitzpatrick
fd1abac71c time: fix race
Fixes #4622

R=golang-dev, dave, dvyukov
CC=golang-dev
https://golang.org/cl/7103046
2013-01-14 14:09:42 -08:00
Robert Griesemer
6c3736a527 go/types: mark completely imported packages as such
R=adonovan
CC=golang-dev
https://golang.org/cl/7103055
2013-01-14 11:01:27 -08:00
Robert Griesemer
7f18f81192 go/types: callback for *ast.Ident -> Object mapping
Also re-enabled resolver test.

R=adonovan
CC=golang-dev
https://golang.org/cl/7107043
2013-01-14 09:43:27 -08:00
Francesc Campoy
1590be9e6f html/template: Clarifying references to "text/template" in the documentation.
Fixes #4634.

R=adg, kevlar
CC=golang-dev
https://golang.org/cl/7066053
2013-01-14 12:11:22 +00:00
Mikio Hara
a0509d8510 syscall: simplify netlink sockets
R=dave, rsc
CC=golang-dev
https://golang.org/cl/7039044
2013-01-14 19:29:03 +09:00
Rémy Oudompheng
406ca3c2f1 encoding/json: fix panics on type mismatches.
Fixes #4222.
Fixes #4628.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7100049
2013-01-14 08:44:16 +01:00
Alex Brainman
06af0ea3f3 encoding/gob: fix broken test (fix build)
R=golang-dev, kevlar
CC=adg, golang-dev
https://golang.org/cl/7093056
2013-01-14 17:03:19 +11:00
Kyle Lemons
bc1152a32e encoding/gob: handle encoding of different indirects of GobEncoder
Fixes #4647.

R=r, golang-dev
CC=golang-dev
https://golang.org/cl/7085051
2013-01-14 16:07:11 +11:00
Robert Griesemer
94878070af go/types: Moving from *ast.Objects to types.Objects (step 2).
Completely removed *ast.Objects from being exposed by the
types API. *ast.Objects are still required internally for
resolution, but now the door is open for an internal-only
rewrite of identifier resolution entirely at type-check
time. Once that is done, ASTs can be type-checked whether
they have been created via the go/parser or otherwise,
and type-checking does not require *ast.Object or scope
invariants to be maintained externally.

R=adonovan
CC=golang-dev
https://golang.org/cl/7096048
2013-01-13 10:33:08 -08:00
Rémy Oudompheng
c13866db7f cmd/5c: fix handling of side effects when assigning a struct literal.
Also undo revision a5b96b602690 used to workaround the bug.

Fixes #4643.

R=rsc, golang-dev, dave, minux.ma, lucio.dere, bradfitz
CC=golang-dev
https://golang.org/cl/7090043
2013-01-12 09:16:50 +01:00
Caleb Spare
b78f5f0e3a testing: document whitespace trimming of example expected/actual output.
Fixes #4642.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7090044
2013-01-12 11:18:15 +11:00
Kamil Kisiel
ad63c7e50b text/template: Document that range can be used on chan types.
Fixes #4640.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7082044
2013-01-12 11:06:13 +11:00
Ryan Slade
3073a02b19 testing: in example, empty output not distinguished from missing output
Fixes #4485.

R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/7071050
2013-01-12 11:05:53 +11:00
Brad Fitzpatrick
05bf9a456a net/http/cgi: fix test case sensitivity on Windows
Fixes #4645

R=golang-dev, alex.brainman, minux.ma
CC=golang-dev
https://golang.org/cl/7105047
2013-01-11 15:11:08 -08:00
Robert Griesemer
8b62f54eb7 go/types: export QualifiedName.IsSame and NamedType.AstObj
R=adonovan
CC=golang-dev
https://golang.org/cl/7103047
2013-01-11 14:55:49 -08:00
Brad Fitzpatrick
20130f141f database/sql: document args, add a couple examples
Fixes #3460

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/7096046
2013-01-11 14:46:49 -08:00
Robert Griesemer
5a9463bda7 go/types: Moving from *ast.Objects to types.Objects (step 1).
The existing type checker was relying on augmenting ast.Object
fields (empty interfaces) for its purposes. While this worked
for some time now, it has become increasingly brittle. Also,
the need for package information for Fields and Methods would
have required a new field in each ast.Object. Rather than making
them bigger and the code even more subtle, in this CL we are moving
away from ast.Objects.

The types packge now defines its own objects for different
language entities (Const, Var, TypeName, Func), and they
implement the types.Object interface. Imported packages
create a Package object which holds the exported entities
in a types.Scope of types.Objects.

For type-checking, the current package is still using ast.Objects
to make this transition manageable. In a next step, the type-
checker will also use types.Objects instead, which opens the door
door to resolving ASTs entirely by the type checker. As a result,
the AST and type checker become less entangled, and ASTs can be
manipulated "by hand" or programmatically w/o having to worry
about scope and object invariants that are very hard to maintain.

(As a consequence, a future parser can do less work, and a
future AST will not need to define objects and scopes anymore.
Also, object resolution which is now split across the parser,
the ast, (ast.NewPackage), and even the type checker (for composite
literal keys) can be done in a single place which will be simpler
and more efficient.)

Change details:
- Check now takes a []*ast.File instead of a map[string]*ast.File.
It's easier to handle (I deleted code at all use sites) and does
not suffer from undefined order (which is a pain for testing).
- ast.Object.Data is now a *types.Package rather then an *ast.Scope
if the object is a package (obj.Kind == ast.Pkg). Eventually this
will go away altogether.
- Instead of an ast.Importer, Check now uses a types.Importer
(which returns a *types.Package).
- types.NamedType has two object fields (Obj Object and obj *ast.Object);
eventually there will be only Obj. The *ast.Object is needed during
this transition since a NamedType may refer to either an imported
(using types.Object) or locally defined (using *ast.Object) type.
- ast.NewPackage is not used anymore - there's a local copy for
package-level resolution of imports.
- struct fields now take the package origin into account.
- The GcImporter is now returning a *types.Package. It cannot be
used with ast.NewPackage anymore. If that functionality is still
used, a copy of the old GcImporter should be made locally (note
that GcImporter was part of exp/types and it's API was not frozen).
- dot-imports are not handled for the time being (this will come back).

R=adonovan
CC=golang-dev
https://golang.org/cl/7058060
2013-01-11 13:53:38 -08:00
Gwenael Treguier
7f0449a108 database/sql: check NumInput on Stmt.Exec
Fixes #3678.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6460087
2013-01-11 13:28:33 -08:00
Brad Fitzpatrick
bef4cb475c net/http: buffer before chunking
This introduces a buffer between writing from a handler and
writing chunks.  Further, it delays writing the header until
the first full chunk is ready.  In the case where the first
full chunk is also the final chunk (for small responses), that
means we can also compute a Content-Length, which is a nice
side effect for certain benchmarks.

Fixes #2357

R=golang-dev, dave, minux.ma, rsc, adg, balasanjay
CC=golang-dev
https://golang.org/cl/6964043
2013-01-11 10:03:43 -08:00
Georg Reinke
98259b9211 os: use syscall.Pipe2 on Linux
Update #2656

R=golang-dev, iant, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/7065063
2013-01-11 08:30:25 -08:00
Stéphane Travostino
53e342f648 bytes: fix UnreadByte failure after ReadBytes
Fixes #4583.

R=golang-dev, minux.ma, bradfitz, rsc, dave
CC=golang-dev
https://golang.org/cl/6976050
2013-01-11 17:02:21 +11:00
Rick Arnold
60abc6b577 encoding/json: improve performance of Unmarshal on primitive types
Skip most of the scanning and parsing logic for simple (non-object/array) JSON values.

benchmark                   old ns/op    new ns/op    delta
BenchmarkUnmarshalInt             948          436  -54.01%
BenchmarkUnmarshalUint            930          427  -54.09%
BenchmarkUnmarshalString         1407          715  -49.18%
BenchmarkUnmarshalFloat          1114          536  -51.89%
BenchmarkUnmarshalBool            759          266  -64.95%
BenchmarkUnmarshalStruct         8165         8181   +0.20%

No significant effects on the go1 benchmarks:

benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    9647362752   9596196417   -0.53%
BenchmarkFannkuch11      5623613048   5518694872   -1.87%
BenchmarkGobDecode         32944041     33165434   +0.67%
BenchmarkGobEncode         21237482     21080554   -0.74%
BenchmarkGzip             750955920    749861980   -0.15%
BenchmarkGunzip           197369742    197886192   +0.26%
BenchmarkJSONEncode        79274091     78891137   -0.48%
BenchmarkJSONDecode       180257802    175280358   -2.76%
BenchmarkMandelbrot200      7396666      7388266   -0.11%
BenchmarkParse             11446460     11386550   -0.52%
BenchmarkRevcomp         1605152523   1599512029   -0.35%
BenchmarkTemplate         204538247    207765574   +1.58%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkGobDecode            23.30        23.14    0.99x
BenchmarkGobEncode            36.14        36.41    1.01x
BenchmarkGzip                 25.84        25.88    1.00x
BenchmarkGunzip               98.32        98.06    1.00x
BenchmarkJSONEncode           24.48        24.60    1.00x
BenchmarkJSONDecode           10.76        11.07    1.03x
BenchmarkParse                 5.06         5.09    1.01x
BenchmarkRevcomp             158.34       158.90    1.00x
BenchmarkTemplate              9.49         9.34    0.98x

Fixes #3949.

R=golang-dev, dave, bradfitz, timo
CC=golang-dev
https://golang.org/cl/7068043
2013-01-10 17:58:45 -08:00
Alex Brainman
810e439859 net: use windows ConnectEx to dial (when possible)
Update #2631.
Update #3097.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7061060
2013-01-11 12:42:09 +11:00
Georg Reinke
e32d1154ec syscall: implement Pipe2 on Linux and use it in ForkExec
Fixes #2656.

R=golang-dev, bradfitz, iant, minux.ma
CC=golang-dev
https://golang.org/cl/7062057
2013-01-10 17:04:55 -08:00
Rémy Oudompheng
6e981c181c runtime: work around 5c bug in GC code.
5c miscompiles *p++ = struct_literal.

R=dave, golang-dev
CC=golang-dev
https://golang.org/cl/7065069
2013-01-11 00:59:44 +01:00
Jan Ziak
9204eb4d3c runtime: interpret type information during garbage collection
R=rsc, dvyukov, remyoudompheng, dave, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/6945069
2013-01-10 15:45:46 -05:00
Dmitriy Vyukov
7847f328cd runtime: faster segmented stacks
benchmark                      old ns/op    new ns/op    delta
BenchmarkStackGrowth                 665          548  -17.59%
BenchmarkStackGrowth-2               333          274  -17.72%
BenchmarkStackGrowth-4               224          168  -25.00%
BenchmarkStackGrowth-8               124           91  -26.21%
BenchmarkStackGrowth-16               82           70  -14.55%
BenchmarkStackGrowth-32               73           59  -19.49%

R=nigeltao, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7026044
2013-01-10 11:36:40 +04:00
Dmitriy Vyukov
f82db7d9e4 runtime: less aggressive per-thread stack segment caching
Introduce global stack segment cache and limit per-thread cache size.
This greatly reduces StackSys memory on workloads that create lots of threads.

benchmark                      old ns/op    new ns/op    delta
BenchmarkStackGrowth                 665          656   -1.35%
BenchmarkStackGrowth-2               333          328   -1.50%
BenchmarkStackGrowth-4               224          172  -23.21%
BenchmarkStackGrowth-8               124           91  -26.13%
BenchmarkStackGrowth-16               82           47  -41.94%
BenchmarkStackGrowth-32               73           40  -44.79%

BenchmarkStackGrowthDeep           97231        94391   -2.92%
BenchmarkStackGrowthDeep-2         47230        58562  +23.99%
BenchmarkStackGrowthDeep-4         24993        49356  +97.48%
BenchmarkStackGrowthDeep-8         15105        30072  +99.09%
BenchmarkStackGrowthDeep-16        10005        15623  +56.15%
BenchmarkStackGrowthDeep-32        12517        13069   +4.41%

TestStackMem#1,MB                  310          12       -96.13%
TestStackMem#2,MB                  296          14       -95.27%
TestStackMem#3,MB                  479          14       -97.08%

TestStackMem#1,sec                 3.22         2.26     -29.81%
TestStackMem#2,sec                 2.43         2.15     -11.52%
TestStackMem#3,sec                 2.50         2.38      -4.80%

R=sougou, no.smile.face, rsc
CC=golang-dev, msolomon
https://golang.org/cl/7029044
2013-01-10 09:57:06 +04:00
Robert Griesemer
ecb75486f8 container/list: avoid memory leaks
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7065067
2013-01-09 15:22:48 -08:00
Rémy Oudompheng
e0bf0374ca go/types: don't parse imported packages multiple times.
R=dave, golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7068044
2013-01-09 22:03:41 +01:00
Robert Griesemer
0141c92a53 go/printer, gofmt: don't print unneeded parentheses around parameter types
Fixes #4624.

R=rsc
CC=golang-dev
https://golang.org/cl/7058052
2013-01-09 11:32:16 -08:00
Robert Griesemer
82accf44bf go/parser: better error message for declaration error
Fixes #4616.

R=rsc
CC=golang-dev
https://golang.org/cl/7069049
2013-01-09 11:31:57 -08:00