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

126 Commits

Author SHA1 Message Date
Dave Cheney
d472d3faf1 bytes: add assembly version of Equal for ARM
BenchmarkEqual32                       662          159  -75.98%
BenchmarkEqual4K                     76545        13719  -82.08%
BenchmarkEqual4M                  90136700     23588870  -73.83%
BenchmarkEqual64M               2147483647   1419616000  -42.63%

BenchmarkEqual32                     48.32       201.15    4.16x
BenchmarkEqual4K                     53.51       298.56    5.58x
BenchmarkEqual4M                     46.53       177.81    3.82x
BenchmarkEqual64M                    27.12        47.27    1.74x

R=golang-dev, qyzhai, minux.ma, rsc, iant, nigeltao
CC=golang-dev
https://golang.org/cl/6118049
2012-05-02 12:10:24 +10:00
Dave Cheney
0681b13437 bytes: add assembly version of IndexByte for ARM
benchmark                        old ns/op    new ns/op    delta
BenchmarkIndexByte32                   459          126  -72.55%
BenchmarkIndexByte4K                 52404        10939  -79.13%
BenchmarkIndexByte4M              54470800     11177370  -79.48%
BenchmarkIndexByte64M           1010803000    178860500  -82.31%

benchmark                         old MB/s     new MB/s  speedup
BenchmarkIndexByte32                 69.58       252.63    3.63x
BenchmarkIndexByte4K                 78.16       374.42    4.79x
BenchmarkIndexByte4M                 77.00       375.25    4.87x
BenchmarkIndexByte64M                66.39       375.20    5.65x

R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6106044
2012-04-25 13:18:31 +10:00
David Symonds
85f2d18a72 bytes: document Compare/Equal semantics for nil arguments, and add tests.
R=golang-dev, bradfitz, r, r
CC=golang-dev
https://golang.org/cl/5676090
2012-02-18 17:39:40 +11:00
Andrew Gerrand
11e113db57 godoc: make example code more readable with new comment convention
go/doc: move Examples to go/ast
cmd/go: use go/doc to read examples
src/pkg: update examples to use new convention

This is to make whole file examples more readable. When presented as a
complete function, preceding an Example with its output is confusing.
The new convention is to put the expected output in the final comment
of the example, preceded by the string "output:" (case insensitive).

An idiomatic example looks like this:

// This example demonstrates Foo by doing bar and quux.
func ExampleFoo() {
        // example body that does bar and quux

        // Output:
        // example output
}

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5673053
2012-02-16 11:50:28 +11:00
Brad Fitzpatrick
7127b6fddc bytes,strings: make *Reader implement io.ReaderAt
R=golang-dev, adg, bradfitz, r
CC=golang-dev
https://golang.org/cl/5675053
2012-02-15 12:58:00 +11:00
Brad Fitzpatrick
977e8d145b bytes: add Reader
copy of strings/reader{,_test}.go with
a few s/string/[]byte/

Fixes #2861

R=adg, rsc, r
CC=golang-dev
https://golang.org/cl/5666044
2012-02-15 11:06:16 +11:00
Rob Pike
c59dc485cd bytes.Buffer: return error in WriteTo if buffer is not drained
R=rsc
CC=golang-dev
https://golang.org/cl/5642065
2012-02-09 08:58:40 +11:00
Rob Pike
0a75a79cc0 bytes: API tweaks
- fix documentation for NewBuffer and NewBufferString
- document and implement behavior of Truncate on invalid lengths

Fixes #2837.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/5637044
2012-02-06 15:29:21 +11:00
Russ Cox
2050a9e478 build: remove Make.pkg, Make.tool
Consequently, remove many package Makefiles,
and shorten the few that remain.

gomake becomes 'go tool make'.

Turn off test phases of run.bash that do not work,
flagged with $BROKEN.  Future CLs will restore these,
but this seemed like a big enough CL already.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5601057
2012-01-30 23:43:46 -05:00
Rob Pike
87079cc14c bytes: delete the test for huge buffers
It takes too much memory to be reliable and causes
trouble on 32-bit machines.
Sigh.

Fixes #2756.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5567043
2012-01-22 09:25:47 -08:00
Robert Griesemer
e17afa4d0c bytes.Buffer: remove dead code, complete documentation
R=r, dave, r
CC=golang-dev
https://golang.org/cl/5533086
2012-01-21 21:31:21 -08:00
Rob Pike
b0d2713b77 bytes.Buffer: restore panic on out-of-memory
Make the panic detectable, and use that in ioutil.ReadFile to
give an error if the file is too big.

R=golang-dev, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/5563045
2012-01-21 09:46:59 -08:00
Robert Griesemer
35ba05ee28 bytes: simplified logic
Also: Avoid potential crash due to reslicing of nil buffer.

R=r
CC=golang-dev
https://golang.org/cl/5556075
2012-01-20 15:39:14 -08:00
Rob Pike
696bf79350 bytes.Buffer: turn buffer size overflows into errors
Fixes #2743.

R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/5556072
2012-01-20 13:51:49 -08:00
Olivier Duperray
dcc5fe1e20 pkg/bytes: add the usual copyright notice to example_test.go
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5553050
2012-01-18 09:40:50 -08:00
Brad Fitzpatrick
87ceb0cec7 bytes: make Write and WriteString code look the same
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5540056
2012-01-13 11:48:57 -08:00
Rob Pike
6a88f1c4cb bytes.Buffer: read of 0 bytes at EOF shouldn't be an EOF
This corner case arose doing an RPC with a empty-slice payload. Ouch.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5505073
2011-12-26 23:49:24 -08:00
Rob Pike
6b772462e4 panics: use the new facilities of testing.B instead
Lots of panics go away.
Also fix a name error in html/template.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5498045
2011-12-20 10:36:25 -08:00
Andrew Gerrand
9834a25d33 testing: trim spaces before comparing example output
bytes: add two Buffer examples

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5490048
2011-12-16 09:43:58 +11:00
Robert Griesemer
9f65e99ad4 go/printer, gofmt: don't write too many newlines
In some rare cases, gofmt would accept more than the maximum
number of empty lines (1) between source code snippets.

The actual change is in printer.go, lines 773-775; the rest
is some minor restructuring.

Applied gofmt -w src misc .

Fixes #2387.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5496047
2011-12-15 13:51:47 -08:00
Russ Cox
a250f37cbc update tree for new default type rule
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5448091
2011-12-08 22:08:03 -05:00
Russ Cox
1278c6c055 bytes: lost edit from earlier CL
R=iant
CC=golang-dev
https://golang.org/cl/5450125
2011-12-07 15:30:01 -05:00
Russ Cox
9b875bc037 bytes: faster Count, Index, Equal
Benchmarks are from GOARCH=amd64 on a MacPro5,1.

benchmark                                    old MB/s     new MB/s  speedup
bytes_test.BenchmarkEqual32                    452.89       891.07    1.97x
bytes_test.BenchmarkEqual4K                    852.71      1700.44    1.99x
bytes_test.BenchmarkEqual4M                    841.53      1587.93    1.89x
bytes_test.BenchmarkEqual64M                   838.22      1578.14    1.88x

bytes_test.BenchmarkIndex32                     58.02        48.99    0.84x
bytes_test.BenchmarkIndex4K                     48.26        41.32    0.86x
bytes_test.BenchmarkIndex4M                     48.20        41.24    0.86x
bytes_test.BenchmarkIndex64M                    48.08        41.21    0.86x
bytes_test.BenchmarkIndexEasy32                410.04       546.82    1.33x
bytes_test.BenchmarkIndexEasy4K                849.26     14257.37   16.79x
bytes_test.BenchmarkIndexEasy4M                854.54     17222.15   20.15x
bytes_test.BenchmarkIndexEasy64M               843.57     11060.40   13.11x

bytes_test.BenchmarkCount32                     57.24        50.68    0.89x
bytes_test.BenchmarkCount4K                     48.19        41.82    0.87x
bytes_test.BenchmarkCount4M                     48.18        41.74    0.87x
bytes_test.BenchmarkCount64M                    48.17        41.71    0.87x
bytes_test.BenchmarkCountEasy32                433.11       547.44    1.26x
bytes_test.BenchmarkCountEasy4K               1130.59     14194.06   12.55x
bytes_test.BenchmarkCountEasy4M               1131.23     17231.18   15.23x
bytes_test.BenchmarkCountEasy64M              1111.40     11068.88    9.96x

The non-easy Count/Index benchmarks are a worst case input.

regexp.BenchmarkMatchEasy0_32                  237.46       221.47    0.93x
regexp.BenchmarkMatchEasy0_1K                  553.53      1019.72    1.84x
regexp.BenchmarkMatchEasy0_32K                 693.99      1672.06    2.41x
regexp.BenchmarkMatchEasy0_1M                  688.72      1611.68    2.34x
regexp.BenchmarkMatchEasy0_32M                 680.70      1565.05    2.30x
regexp.BenchmarkMatchEasy1_32                  165.56       243.08    1.47x
regexp.BenchmarkMatchEasy1_1K                  336.45       496.32    1.48x
regexp.BenchmarkMatchEasy1_32K                 302.80       425.63    1.41x
regexp.BenchmarkMatchEasy1_1M                  300.42       414.20    1.38x
regexp.BenchmarkMatchEasy1_32M                 299.64       413.47    1.38x

R=golang-dev, r, iant
CC=golang-dev
https://golang.org/cl/5451116
2011-12-07 15:09:56 -05:00
Christopher Wedgwood
7600281bda bytes: fix test output
R=rsc, gri
CC=golang-dev
https://golang.org/cl/5441048
2011-11-28 09:50:51 -08:00
Russ Cox
558e7fc332 various: avoid func compare
R=gri, r, bradfitz
CC=golang-dev
https://golang.org/cl/5371074
2011-11-13 22:57:19 -05:00
Rob Pike
30aa701fec renaming_2: gofix -r go1pkgrename src/pkg/[a-l]*
R=rsc
CC=golang-dev
https://golang.org/cl/5358041
2011-11-08 15:40:58 -08:00
Andrew Gerrand
ed92549071 bytes: fix typo and resolve to be less idiotic next time
R=bradfitz
CC=golang-dev
https://golang.org/cl/5340044
2011-11-04 17:55:21 +11:00
Andrew Gerrand
1a4402a1fe bytes: add Contains function
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5349041
2011-11-04 17:46:52 +11:00
Vincent Vanackere
eb1717e035 all: rename os.EOF to io.EOF in various non-code contexts
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5334050
2011-11-03 14:01:30 -07:00
Russ Cox
c2049d2dfe src/pkg/[a-m]*: gofix -r error -force=error
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5322051
2011-11-01 22:04:37 -04:00
Russ Cox
8f5718176f bytes, strings: use rune
Various rune-based APIs change.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5306044
2011-10-25 22:22:09 -07:00
Christopher Wedgwood
707e5acd71 updates: append(y,[]byte(z)...) -> append(y,z...)"
(more are possible but omitted for now as they are part of
specific tests where rather than changing what is there we
should probably expand the tests to cover the new case)

R=rsc, dvyukov
CC=golang-dev
https://golang.org/cl/5247058
2011-10-12 13:42:04 -07:00
Russ Cox
c68ae9d467 bytes: add EqualFold
R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5123047
2011-09-26 19:35:32 -04:00
Gustavo Niemeyer
d16ceca5c5 bytes: fix Replace so it actually copies
The documentation for bytes.Replace says it copies
the slice but it won't necessarily copy them.  Since
the data is mutable, breaking the contract is an issue.

We either have to fix this by making the copy at all
times, as suggested in this CL, or we should change the
documentation and perhaps make better use of the fact
it's fine to mutate the slice in place otherwise.

R=golang-dev, bradfitz, adg, rsc
CC=golang-dev
https://golang.org/cl/5081043
2011-09-21 12:36:17 -03:00
Rob Pike
a45c657db1 bytes.Buffer: clarify that NewBuffer is not for beginners
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4965048
2011-08-26 15:09:23 +10:00
Robert Griesemer
90564a9256 go/printer: changed max. number of newlines from 3 to 2
manual changes in src/pkg/go/printer, src/cmd/gofix/signal_test.go
(cd src/cmd/gofix/testdata; gofmt -w *.in *.out)
(cd src/pkg/go/printer; gotest -update)
gofmt -w misc src

runs all tests

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4715041
2011-07-14 14:39:40 -07:00
Rob Pike
ebb1566a46 strings.Split: make the default to split all.
Change the signature of Split to have no count,
assuming a full split, and rename the existing
Split with a count to SplitN.
Do the same to package bytes.
Add a gofix module.

R=adg, dsymonds, alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/4661051
2011-06-28 09:43:14 +10:00
Robert Griesemer
712fb6dcd3 os.Error API: don't export os.ErrorString, use os.NewError consistently
This is a core API change.

1) gofix misc src
2) Manual adjustments to the following files under src/pkg:
   gob/decode.go
   rpc/client.go
   os/error.go
   io/io.go
   bufio/bufio.go
   http/request.go
   websocket/client.go
as well as:
   src/cmd/gofix/testdata/*.go.in (reverted)
   test/fixedbugs/bug243.go
3) Implemented gofix patch (oserrorstring.go) and test case (oserrorstring_test.go)

Compiles and runs all tests.

R=r, rsc, gri
CC=golang-dev
https://golang.org/cl/4607052
2011-06-22 10:52:47 -07:00
Nigel Tao
6a186d38d1 src/pkg: make package doc comments consistently start with "Package foo".
R=rsc
CC=golang-dev
https://golang.org/cl/4442064
2011-04-20 09:57:05 +10:00
Evan Shaw
47f4ae1a78 bytes, strings: simplify Join
R=gri, rsc
CC=golang-dev
https://golang.org/cl/4300044
2011-03-29 01:27:38 -04:00
Rob Pike
f0cf7d296c testing: shorten some tests.
These are the top runners.  More to come.
Also print two digits of timing info under -test.v.

R=rsc
CC=golang-dev
https://golang.org/cl/4317044
2011-03-25 16:31:10 -07:00
Evan Shaw
bbfad5f1cc bytes: fix bugs in buffer.ReadBytes
Fixes #1498.

R=golang-dev, mattn, r, rsc
CC=golang-dev
https://golang.org/cl/4140041
2011-02-11 12:39:18 -05:00
Robert Griesemer
4438f50293 buffer.go: minor optimization, expanded comment
R=r
CC=golang-dev
https://golang.org/cl/4169043
2011-02-09 15:09:08 -08:00
Evan Shaw
c9bf30cf19 bytes: Add Buffer.ReadBytes, Buffer.ReadString
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4000046
2011-01-27 14:00:31 -08:00
Rob Pike
7b4495c041 bytes.Buffer: fix typo in comment (doubled 'to')
R=ken2
CC=golang-dev
https://golang.org/cl/4035041
2011-01-14 23:00:02 -08:00
Peter Mundy
2b0a276129 bytes: fix TrimSpace typo
Fixes #1401.

R=golang-dev, agl1
CC=golang-dev
https://golang.org/cl/3937041
2011-01-09 12:11:16 -05:00
Rob Pike
353fd1014c bytes.Buffer: Fix bug in UnreadByte.
Error check was inverted.

Fixes #1396.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/3851042
2011-01-07 14:41:33 -08:00
Rob Pike
1ce6245d6c throughout: fix broken calls to Printf etc.
I have written a tool to verify Printf calls, and although it's not
ready to be reviewed yet it's already uncovered a spate of problems
in the repository.  I'm sending this CL to break the changes into
pieces; as the tool improves it will find more, I'm sure.

R=rsc
CC=golang-dev
https://golang.org/cl/3427043
2010-12-07 16:42:54 -05:00
Rob Pike
42cfe48ffc use the new %U format for runes
R=rsc
CC=golang-dev
https://golang.org/cl/3483041
2010-12-06 14:38:25 -05:00
Roger Peppe
415545e539 bytes: add Buffer.UnreadRune, Buffer.UnreadByte
R=rsc, r
CC=golang-dev
https://golang.org/cl/3421041
2010-12-06 14:10:10 -05:00