summaryrefslogtreecommitdiff
path: root/src/pkg/bytes/buffer.go
AgeCommit message (Collapse)AuthorFilesLines
2011-08-03Imported Upstream version 59upstream/59Ondřej Surý1-2/+2
2011-02-18Imported Upstream version 2011.02.15upstream/2011.02.15Ondřej Surý1-4/+8
2011-02-14Imported Upstream version 2011-02-01.1upstream/2011-02-01.1Ondřej Surý1-1/+30
2011-01-17Imported Upstream version 2011.01.12upstream/2011.01.12Ondřej Surý1-14/+64
2010-06-15bytes.Buffer.ReadFrom: fix bug.Rob Pike1-1/+1
Fixes issue 852. R=rsc CC=golang-dev http://codereview.appspot.com/1680042
2010-05-27changes &x -> x[0:] for array to slice conversionRuss Cox1-2/+2
R=gri CC=golang-dev http://codereview.appspot.com/1326042
2010-04-26bytes: add Next method to Buffer, simplify Read.Russ Cox1-6/+12
R=r CC=golang-dev http://codereview.appspot.com/980043
2010-04-14bytes: shuffle implementation, making WriteByte 50% fasterRuss Cox1-37/+27
R=r CC=golang-dev http://codereview.appspot.com/920041
2010-03-05Add ReadRune and WriteRune to bytes.BufferRob Pike1-6/+42
The comments mention bufio's WriteRune, which should come next. R=rsc CC=golang-dev http://codereview.appspot.com/245041
2010-01-02Remove redundant size check in resize. Let callers worry about that and ↵Yongjian Xu1-5/+2
resize should just do "resize". R=golang-dev, r CC=golang-dev http://codereview.appspot.com/181111 Committer: Rob Pike <r@golang.org>
2009-12-19new comments for bytes.NewBuffer and NewBufferString.Rob Pike1-8/+12
corrects a common misunderstanding about NewBuffer. R=rsc CC=golang-dev http://codereview.appspot.com/179106
2009-12-15 1) Change default gofmt default settings forRobert Griesemer1-60/+60
parsing and printing to new syntax. Use -oldparser to parse the old syntax, use -oldprinter to print the old syntax. 2) Change default gofmt formatting settings to use tabs for indentation only and to use spaces for alignment. This will make the code alignment insensitive to an editor's tabwidth. Use -spaces=false to use tabs for alignment. 3) Manually changed src/exp/parser/parser_test.go so that it doesn't try to parse the parser's source files using the old syntax (they have new syntax now). 4) gofmt -w src misc test/bench 1st set of files. R=rsc CC=agl, golang-dev, iant, ken2, r http://codereview.appspot.com/180047
2009-12-14When the buffer is empty, reset b.off to the beginning of the bufferRob Pike1-2/+20
to avoid growing unnecessarily. R=rsc CC=golang-dev http://codereview.appspot.com/176071
2009-12-07Remove copyBytes completely in favor of copy.Christopher Wedgwood1-11/+2
R=r, rsc http://codereview.appspot.com/165068 Committer: Rob Pike <r@golang.org>
2009-12-06Make printing faster by avoiding mallocs and some other advances.Rob Pike1-37/+37
Roughly 33% faster for simple cases, probably more for complex ones. Before: mallocs per Sprintf(""): 4 mallocs per Sprintf("xxx"): 6 mallocs per Sprintf("%x"): 10 mallocs per Sprintf("%x %x"): 12 Now: mallocs per Sprintf(""): 2 mallocs per Sprintf("xxx"): 3 mallocs per Sprintf("%x"): 5 mallocs per Sprintf("%x %x"): 7 Speed improves because of avoiding mallocs and also by sharing a bytes.Buffer between print.go and format.go rather than copying the data back after each printed item. Before: fmt_test.BenchmarkSprintfEmpty 1000000 1346 ns/op fmt_test.BenchmarkSprintfString 500000 3461 ns/op fmt_test.BenchmarkSprintfInt 500000 3671 ns/op Now: fmt_test.BenchmarkSprintfEmpty 2000000 995 ns/op fmt_test.BenchmarkSprintfString 1000000 2745 ns/op fmt_test.BenchmarkSprintfInt 1000000 2391 ns/op fmt_test.BenchmarkSprintfIntInt 500000 3751 ns/op I believe there is more to get but this is a good milestone. R=rsc CC=golang-dev, hong http://codereview.appspot.com/166076
2009-12-04avoid an allocation inside bytes.Buffer by providing a static array.Rob Pike1-8/+4
R=rsc http://codereview.appspot.com/165058
2009-12-03Add ReadFrom and WriteTo methods to bytes.Buffer, to enable i/o without ↵Rob Pike1-0/+55
buffer allocation. Use them in Copy and Copyn. Speed up ReadFile by using ReadFrom and avoiding Copy altogether (a minor win). R=rsc, gri CC=golang-dev http://codereview.appspot.com/166041
2009-11-20gofmt -r 'α[β:len(α)] -> α[β:]' -w src/cmd src/pkgRuss Cox1-3/+3
R=r, gri CC=golang-dev http://codereview.appspot.com/156115
2009-11-18remove bytes.CopyRob Pike1-3/+4
replace all calls with calls to copy use copy in regexp and bytes.Buffer R=rsc CC=golang-dev http://codereview.appspot.com/157073
2009-11-09- replaced gofmt expression formatting algorithm withRobert Griesemer1-12/+12
rsc's algorithm - applied gofmt -w misc src - partial CL (remaining files in other CLs) R=rsc, r http://go/go-review/1024040
2009-11-09remove semis after statements in one-statement statement listsRobert Griesemer1-8/+8
R=rsc, r http://go/go-review/1025029
2009-11-06- fine-tuning of one-line func heuristic (nodes.go)Robert Griesemer1-12/+4
- enabled for function declarations (not just function literals) - applied gofmt -w $GOROOT/src (look for instance at src/pkg/debug/elf/elf.go) R=r, rsc CC=go-dev http://go/go-review/1026006
2009-11-04gofmt-ify bytesRobert Griesemer1-1/+1
R=r http://go/go-review/1016044
2009-10-31return "<nil>" when calling String() on a nil bytes.Buffer.Rob Pike1-1/+5
R=rsc CC=go-dev http://go/go-review/1016005
2009-10-08more lgtm files from gofmtRuss Cox1-20/+20
R=gri OCL=35485 CL=35488
2009-09-22restore the old algorithm. the new one is more memory efficient in large casesRob Pike1-262/+93
but too slow across the board. R=rsc DELTA=315 (50 added, 219 deleted, 46 changed) OCL=34868 CL=34902
2009-09-21move strings.Buffer into bytesRob Pike1-62/+276
delete strings.Buffer add a test for a bug not caught before (mustn't install zero-length blocks) R=rsc DELTA=987 (289 added, 587 deleted, 111 changed) OCL=34850 CL=34850
2009-09-16rename bytes.Buffer.Data() to bytes.Buffer.Bytes()Rob Pike1-4/+10
R=rsc DELTA=152 (6 added, 0 deleted, 146 changed) OCL=34695 CL=34701
2009-08-12convert low-level (used by testing) packages toRuss Cox1-1/+0
whole-package compilation. new Makefiles, tests now in separate package bytes flag fmt io math once os reflect strconv sync time utf8 delete import "xxx" in package xxx. inside package xxx, xxx is not declared anymore so s/xxx.//g delete file and package level forward declarations. note the new internal_test.go and sync and strconv to provide public access to internals during testing. the installed version of the package omits that file and thus does not open the internals to all clients. R=r OCL=33065 CL=33097
2009-06-29io.StringBytes -> strings.BytesRuss Cox1-0/+125
io.ByteBuffer -> bytes.Buffer left io.ByteBuffer stub around for now, for protocol compiler. R=r OCL=30861 CL=30872