1
0
mirror of https://github.com/golang/go synced 2024-11-12 07:50:23 -07:00
The Go programming language
Go to file
Phil Pearl 317afdc3fb strings: simplify Join using Builder
The existing implementation has a bunch of special cases and
suffers an additional allocation for longer arrays. We can replace
this code with a simple implementation using Builder, improve
performance and reduce complexity.

name      old time/op    new time/op    delta
Join/0-8    3.53ns ± 3%    3.72ns ± 2%   +5.56%  (p=0.000 n=10+10)
Join/1-8    3.94ns ± 4%    3.40ns ± 4%  -13.57%  (p=0.000 n=10+10)
Join/2-8    57.0ns ± 3%    51.0ns ± 1%  -10.48%  (p=0.000 n=10+9)
Join/3-8    74.9ns ± 2%    65.5ns ± 4%  -12.60%  (p=0.000 n=10+10)
Join/4-8     105ns ± 0%      79ns ± 4%  -24.63%  (p=0.000 n=6+10)
Join/5-8     116ns ± 2%      91ns ± 4%  -21.95%  (p=0.000 n=10+10)
Join/6-8     131ns ± 1%     104ns ± 1%  -20.66%  (p=0.000 n=10+10)
Join/7-8     141ns ± 0%     114ns ± 4%  -18.82%  (p=0.000 n=9+10)

name      old alloc/op   new alloc/op   delta
Join/0-8     0.00B          0.00B          ~     (all equal)
Join/1-8     0.00B          0.00B          ~     (all equal)
Join/2-8     16.0B ± 0%     16.0B ± 0%     ~     (all equal)
Join/3-8     32.0B ± 0%     32.0B ± 0%     ~     (all equal)
Join/4-8     96.0B ± 0%     48.0B ± 0%  -50.00%  (p=0.000 n=10+10)
Join/5-8     96.0B ± 0%     48.0B ± 0%  -50.00%  (p=0.000 n=10+10)
Join/6-8      128B ± 0%       64B ± 0%  -50.00%  (p=0.000 n=10+10)
Join/7-8      128B ± 0%       64B ± 0%  -50.00%  (p=0.000 n=10+10)

name      old allocs/op  new allocs/op  delta
Join/0-8      0.00           0.00          ~     (all equal)
Join/1-8      0.00           0.00          ~     (all equal)
Join/2-8      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
Join/3-8      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
Join/4-8      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
Join/5-8      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
Join/6-8      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
Join/7-8      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)

Change-Id: I866a50e809c398512cb87648c955eaa4bf4d8606
Reviewed-on: https://go-review.googlesource.com/132895
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-09-02 20:08:07 +00:00
.github .github: use HTTPS for Stack Overflow link in SUPPORT.md 2018-06-12 11:08:14 +00:00
api syscall: implement Unix Socket for Windows 2018-08-28 09:26:45 +00:00
doc doc: fix os.Pipe() call in the example. 2018-08-31 06:39:16 +00:00
lib/time lib/time: update vendored tzdata to release 2018e 2018-06-11 14:47:06 +00:00
misc all: fix typos detected by github.com/client9/misspell 2018-08-23 15:54:07 +00:00
src strings: simplify Join using Builder 2018-09-02 20:08:07 +00:00
test cmd/compile: add testcase for #24876 2018-09-02 10:34:51 +00:00
.gitattributes .gitattributes: prevent all magic line ending changes 2014-12-12 23:14:54 +00:00
.gitignore .gitignore: ignore src/cmd/dist/dist 2017-10-28 21:55:49 +00:00
AUTHORS A+C: add VMware as author, Venil Noronha as contributor 2018-08-31 02:14:24 +00:00
CONTRIBUTING.md all: restore changes from faulty merge/revert 2018-02-12 20:13:59 +00:00
CONTRIBUTORS A+C: add VMware as author, Venil Noronha as contributor 2018-08-31 02:14:24 +00:00
favicon.ico website: recreate 16px and 32px favicon 2016-08-25 15:43:32 +00:00
LICENSE doc: revert copyright date to 2009 2016-06-01 22:40:04 +00:00
PATENTS
README.md README: linkify some paths 2018-06-06 18:07:01 +00:00
robots.txt

The Go Programming Language

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

Gopher image Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.

Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.

Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.

Download and Install

Binary Distributions

Official binary distributions are available at https://golang.org/dl/.

After downloading a binary release, visit https://golang.org/doc/install or load doc/install.html in your web browser for installation instructions.

Install From Source

If a binary distribution is not available for your combination of operating system and architecture, visit https://golang.org/doc/install/source or load doc/install-source.html in your web browser for source installation instructions.

Contributing

Go is the work of thousands of contributors. We appreciate your help!

To contribute, please read the contribution guidelines: https://golang.org/doc/contribute.html

Note that the Go project uses the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.