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
Kyle Consalus
009aebdba8
Removed bytes.Add and bytes.AddByte; we now have 'append'.
...
Changed all uses of bytes.Add (aside from those testing bytes.Add) to append(a, b...).
Also ran "gofmt -s" and made use of copy([]byte, string) in the fasta benchmark.
R=golang-dev, r, r2
CC=golang-dev
https://golang.org/cl/3302042
2010-12-01 11:59:13 -08:00
Adam Langley
3cb4bdb9ce
utf8: make EncodeRune's destination the first argument.
...
R=r
CC=golang-dev
https://golang.org/cl/3364041
2010-11-30 16:59:43 -05:00
Benny Siegert
8530e8ef65
strings: add LastIndexAny
...
The need for a LastIndexAny function has come up in the discussion
for https://golang.org/cl/3008041/ . This function is
implemented analogously to lastIndexFunc, using functions from
the utf8 package.
R=r, rsc, PeterGo
CC=golang-dev
https://golang.org/cl/3057041
2010-11-12 12:47:50 -08:00
Evan Shaw
49fdfe21dd
bytes: SSE for bytes.IndexByte on amd64
...
Performance on 2.8 GHz Intel Core i7:
Before:
BenchmarkIndexByte4K 1000000 2997 ns/op 1366.70 MB/s
BenchmarkIndexByte4M 500 3049772 ns/op 1375.28 MB/s
BenchmarkIndexByte64M 50 49582280 ns/op 1353.48 MB/s
After:
BenchmarkIndexByte4K 10000000 298 ns/op 13744.97 MB/s
BenchmarkIndexByte4M 10000 285993 ns/op 14665.76 MB/s
BenchmarkIndexByte64M 500 4618172 ns/op 14531.48 MB/s
R=rsc, PeterGo, r2, r
CC=golang-dev
https://golang.org/cl/2888041
2010-11-08 17:33:53 -08:00
Russ Cox
69c4e9380b
use append
...
R=gri, r, r2
CC=golang-dev
https://golang.org/cl/2743042
2010-10-27 19:47:23 -07:00
Russ Cox
d86ab015f7
use copy
...
R=gri
CC=golang-dev
https://golang.org/cl/2763041
2010-10-26 21:52:54 -07:00
Robert Griesemer
3478891d12
gofmt -s -w src misc
...
R=r, rsc
CC=golang-dev
https://golang.org/cl/2662041
2010-10-22 10:06:33 -07:00
Andrew Gerrand
b15b0a0cd9
bytes: fix typo in AddByte comment
...
Fixes #1140 .
R=golang-dev
CC=golang-dev
https://golang.org/cl/2240043
2010-09-27 11:41:43 +10:00
Roger Peppe
81ba399a6a
bytes, strings: change lastIndexFunc to use DecodeLastRune
...
R=r
CC=golang-dev, rsc
https://golang.org/cl/2271041
2010-09-23 20:40:11 +10:00
Rob Pike
1959c3ac5b
tests: fix prints
...
- delete unnecessary newlines
- make sure formatted prints call the formatting routines
R=adg
CC=golang-dev
https://golang.org/cl/2225046
2010-09-23 13:48:56 +10:00
Russ Cox
da392d9136
build: no required environment variables
...
R=adg, r, PeterGo
CC=golang-dev
https://golang.org/cl/1942044
2010-08-18 10:08:49 -04:00
Christian Himpel
75f6a0c759
bytes: add IndexRune, FieldsFunc and To*Special
...
Basically these functions are implemented the same way as the
corresponding functions in the strings package. Test functions
are implemented for IndexRune and FieldsFunc.
Additionally two typos are fixed in packages bytes and strings.
R=r
CC=golang-dev
https://golang.org/cl/1696062
2010-08-05 23:11:06 +10:00
Scott Lawrence
99aab8bacb
bytes: added test case for explode with blank string.
...
Tests for the equivalent of the strings.explode("") panic bug (issue 980).
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/1850052
2010-08-04 13:33:24 +10:00
Andrew Gerrand
8b821696cc
bytes, strings: mention the n < 0 case in Split/SplitAfter doc comment
...
R=r, rsc
CC=golang-dev
https://golang.org/cl/1669055
2010-07-27 15:06:08 +10:00
Fazlul Shahriar
e356f1d88f
bytes: port IndexFunc and LastIndexFunc from strings package
...
This CL basically applies the same changes as
http://code.google.com/p/go/source/detail?r=5e0a29014e8e
but for bytes package.
R=r, rog
CC=golang-dev
https://golang.org/cl/1670052
2010-07-23 12:34:35 -07:00
Andrey Mirtchovski
8629e5a648
strings.Bytes: fix typo in comment
...
R=adg, rsc
CC=golang-dev
https://golang.org/cl/1886042
2010-07-21 12:01:15 -07:00
Rob Pike
de228c0e0c
bytes: add Title
...
R=rsc
CC=golang-dev
https://golang.org/cl/1872042
2010-07-20 19:53:59 -07:00
Rob Pike
38f1231f3e
strings and bytes.Split: make count of 0 mean 0, not infinite.
...
Use a count of -1 for infinity. Ditto for Replace.
R=rsc
CC=golang-dev
https://golang.org/cl/1704044
2010-07-01 14:08:14 -07:00
Russ Cox
0bf413ab8e
bytes, strings: add Replace
...
This is the Replace I suggested in the review of CL 1114041.
It's true that we already have
regexp.MustCompile(regexp.QuoteMeta(old)).ReplaceAll(s, new)
but because this Replace is doing a simpler job it is
simpler to call and inherently more efficient.
I will add the bytes implementation and tests to the
CL after the strings one has been reviewed.
R=r, cw
CC=golang-dev
https://golang.org/cl/1731048
2010-06-30 18:03:09 -07:00
Russ Cox
44ca04d3d6
big, bytes: move assembly externs to separate file
...
to make it easier to build package without assembly.
R=r, r2
CC=golang-dev
https://golang.org/cl/1680045
2010-06-21 19:53:08 -07:00