aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/bytes/bytes.go
AgeCommit message (Collapse)Author
2014-09-08build: move package sources from src/pkg to srcRuss Cox
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.
2014-08-25strings, bytes: document behavior of Replace when old is emptyCaleb Spare
Fixes #8143. LGTM=r R=rsc, bradfitz, r CC=golang-codereviews https://golang.org/cl/135760043
2014-06-11bytes, strings: optimize RepeatRui Ueyama
Call copy with as large buffer as possible to reduce the number of function calls. benchmark old ns/op new ns/op delta BenchmarkBytesRepeat 540 162 -70.00% BenchmarkStringsRepeat 563 177 -68.56% LGTM=josharian R=golang-codereviews, josharian, dave, dvyukov CC=golang-codereviews https://golang.org/cl/90550043
2014-03-18bytes: fix panic in MapRui Ueyama
utf8.RuneLen returns -1 for an invalid rune. In that case we need to extend the internal buffer at least by 3 for \uFFFD. Fixes #7577. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/77420044
2013-12-12bytes: fix description of FieldsFuncShenghou Ma
Similar to CL 3814041 that fixed the same issue in strings. Fixes #6941. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/41490045
2013-08-27bytes, strings: use copy in RepeatEvan Shaw
R=golang-dev, dave, bradfitz, adg CC=golang-dev https://golang.org/cl/13249043
2013-07-23all: be more idiomatic when documenting boolean return values.Rob Pike
Phrases like "returns whether or not the image is opaque" could be describing what the function does (it always returns, regardless of the opacity) or what it returns (a boolean indicating the opacity). Even when the "or not" is missing, the phrasing is bizarre. Go with "reports whether", which is still clunky but at least makes it clear we're talking about the return value. These were edited by hand. A few were cleaned up in other ways. R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/11699043
2013-05-14runtime/bytes: fast Compare for byte arrays and strings.Keith Randall
Uses SSE instructions to process 16 bytes at a time. fixes #5354 R=bradfitz, google CC=golang-dev https://golang.org/cl/8853048
2013-03-19bytes,strings: remove user name from BUG in commentRob Pike
R=golang-dev, dave CC=golang-dev https://golang.org/cl/7856048
2013-03-15bytes,string: move the BUG to the comment of the function it's aboutRob Pike
Avoids printing it every time we ask a question about the package from the command line. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/7789048
2013-02-10bytes: annotate assembly functions with //go:noescapeShenghou Ma
R=golang-dev, agl, bradfitz, rsc CC=golang-dev https://golang.org/cl/7299064
2013-02-07bytes: minor optimization to lastIndexFuncBrad Fitzpatrick
Before and after: BenchmarkTrimSpace 20000000 81.3 ns/op BenchmarkTrimSpace 50000000 58.0 ns/op (most whitespace trimming is ASCII whitespace) Same optimization appeared a handful of other places in this file, but not here. R=golang-dev, dave CC=golang-dev https://golang.org/cl/7305063
2013-02-01bytes, strings: add TrimPrefix and TrimSuffixBrad Fitzpatrick
Everybody either gets confused and thinks this is TrimLeft/TrimRight or does this by hand which gets repetitive looking. R=rsc, kevlar CC=golang-dev https://golang.org/cl/7239044
2013-01-06bytes: Fix missing godoc punctuation.Matthew Dempsky
R=golang-dev, rsc CC=golang-dev https://golang.org/cl/7067047
2013-01-07bytes: fix docs: s/array/slice/.Nigel Tao
R=rsc, mdempsky, dave CC=golang-dev https://golang.org/cl/7028051
2012-07-20bytes: make Join return a new buffer on len(a) == 1Gustavo Niemeyer
Fixes #3844. R=golang-dev, r CC=golang-dev https://golang.org/cl/6432054
2012-06-18bytes: fixed typo.Marcel van Lohuizen
R=r CC=golang-dev https://golang.org/cl/6301096
2012-02-18bytes: document Compare/Equal semantics for nil arguments, and add tests.David Symonds
R=golang-dev, bradfitz, r, r CC=golang-dev https://golang.org/cl/5676090
2011-12-08update tree for new default type ruleRuss Cox
R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5448091
2011-12-07bytes: faster Count, Index, EqualRuss Cox
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-11-08renaming_2: gofix -r go1pkgrename src/pkg/[a-l]*Rob Pike
R=rsc CC=golang-dev https://golang.org/cl/5358041
2011-11-04bytes: fix typo and resolve to be less idiotic next timeAndrew Gerrand
R=bradfitz CC=golang-dev https://golang.org/cl/5340044
2011-11-04bytes: add Contains functionAndrew Gerrand
R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5349041
2011-10-25bytes, strings: use runeRuss Cox
Various rune-based APIs change. R=golang-dev, r CC=golang-dev https://golang.org/cl/5306044
2011-09-26bytes: add EqualFoldRuss Cox
R=golang-dev, r, r CC=golang-dev https://golang.org/cl/5123047
2011-09-21bytes: fix Replace so it actually copiesGustavo Niemeyer
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-07-14go/printer: changed max. number of newlines from 3 to 2Robert Griesemer
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-06-28strings.Split: make the default to split all.Rob Pike
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-04-20src/pkg: make package doc comments consistently start with "Package foo".Nigel Tao
R=rsc CC=golang-dev https://golang.org/cl/4442064
2011-03-29bytes, strings: simplify JoinEvan Shaw
R=gri, rsc CC=golang-dev https://golang.org/cl/4300044
2011-01-09bytes: fix TrimSpace typoPeter Mundy
Fixes #1401. R=golang-dev, agl1 CC=golang-dev https://golang.org/cl/3937041
2010-12-01Removed bytes.Add and bytes.AddByte; we now have 'append'.Kyle Consalus
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-11-30utf8: make EncodeRune's destination the first argument.Adam Langley
R=r CC=golang-dev https://golang.org/cl/3364041
2010-11-12strings: add LastIndexAnyBenny Siegert
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-10-27use appendRuss Cox
R=gri, r, r2 CC=golang-dev https://golang.org/cl/2743042
2010-10-26use copyRuss Cox
R=gri CC=golang-dev https://golang.org/cl/2763041
2010-09-27bytes: fix typo in AddByte commentAndrew Gerrand
Fixes #1140. R=golang-dev CC=golang-dev https://golang.org/cl/2240043
2010-09-23bytes, strings: change lastIndexFunc to use DecodeLastRuneRoger Peppe
R=r CC=golang-dev, rsc https://golang.org/cl/2271041
2010-08-05bytes: add IndexRune, FieldsFunc and To*SpecialChristian Himpel
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-07-27bytes, strings: mention the n < 0 case in Split/SplitAfter doc commentAndrew Gerrand
R=r, rsc CC=golang-dev https://golang.org/cl/1669055
2010-07-23bytes: port IndexFunc and LastIndexFunc from strings packageFazlul Shahriar
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-21strings.Bytes: fix typo in commentAndrey Mirtchovski
R=adg, rsc CC=golang-dev https://golang.org/cl/1886042
2010-07-20bytes: add TitleRob Pike
R=rsc CC=golang-dev https://golang.org/cl/1872042
2010-07-01strings and bytes.Split: make count of 0 mean 0, not infinite.Rob Pike
Use a count of -1 for infinity. Ditto for Replace. R=rsc CC=golang-dev https://golang.org/cl/1704044
2010-06-30bytes, strings: add ReplaceRuss Cox
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-21big, bytes: move assembly externs to separate fileRuss Cox
to make it easier to build package without assembly. R=r, r2 CC=golang-dev https://golang.org/cl/1680045
2010-05-18bytes: add Trim, TrimLeft, TrimRight, and generic functionsMichael Hoisie
R=rsc, r CC=golang-dev https://golang.org/cl/946045
2010-05-03bytes: Change IndexAny to look for UTF-8 encoded characters.Rob Pike
Also improve the implementations of Equals and Compare. R=rsc CC=golang-dev https://golang.org/cl/969047
2010-03-26bytes, strings: IndexOfAnyRobert Griesemer
+ first use in go/doc R=r CC=golang-dev https://golang.org/cl/781041
2009-12-15bytes, strings: add new function FieldsAndrey Mirtchovski
R=rsc, r, phf CC=golang-dev https://golang.org/cl/170046