commit | 5a0d9ef87387ce620af03274be2dd34a8ba4a99c | [log] [tgz] |
---|---|---|
author | Brad Fitzpatrick <bradfitz@golang.org> | Thu Nov 12 14:09:03 2015 +0000 |
committer | Brad Fitzpatrick <bradfitz@golang.org> | Sat Nov 14 13:12:47 2015 +0000 |
tree | 89c698af2270b6cb95f4b5b561dc5373223deddd | |
parent | ac658a83c28ab3e68e9f21f21c9b0f63d13ca19c [diff] |
crypto/tls, crypto/aes: remove allocations when Writing & Reading benchmark old ns/op new ns/op delta BenchmarkTLS-4 8571 7938 -7.39% benchmark old MB/s new MB/s speedup BenchmarkTLS-4 119.46 128.98 1.08x benchmark old allocs new allocs delta BenchmarkTLS-4 8 0 -100.00% benchmark old bytes new bytes delta BenchmarkTLS-4 128 0 -100.00% On: func BenchmarkTLS(b *testing.B) { b.ReportAllocs() b.SetBytes(1024) ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { io.Copy(ioutil.Discard, r.Body) })) defer ts.Close() buf := make([]byte, 1024) for i := range buf { buf[i] = byte(i) } c, err := tls.Dial("tcp", ts.Listener.Addr().String(), &tls.Config{ InsecureSkipVerify: true, }) if err != nil { b.Fatal(err) } defer c.Close() clen := int64(b.N) * 1024 if _, err := c.Write([]byte( "POST / HTTP/1.1\r\nHost: foo\r\nContent-Length: " + fmt.Sprint(clen) + "\r\n\r\n")); err != nil { b.Fatal(err) } b.ResetTimer() for i := 0; i < b.N; i++ { if _, err := c.Write(buf); err != nil { b.Fatal(err) } } } Change-Id: I206e7e2118b97148f9751b740d8470895634d3f5 Reviewed-on: https://go-review.googlesource.com/16828 Reviewed-by: Adam Langley <agl@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
For documentation about how to install and use Go, visit https://golang.org/ or load doc/install-source.html in your web browser.
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.
Go is the work of hundreds of contributors. We appreciate your help!
To contribute, please read the contribution guidelines: https://golang.org/doc/contribute.html
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
If you have just untarred a binary Go distribution, you need to set the environment variable $GOROOT to the full path of the go directory (the one containing this file). You can omit the variable if you unpack it into /usr/local/go, or if you rebuild from sources by running all.bash (see doc/install-source.html). You should also add the Go binary directory $GOROOT/bin to your shell's path.
For example, if you extracted the tar file into $HOME/go, you might put the following in your .profile:
export GOROOT=$HOME/go export PATH=$PATH:$GOROOT/bin
See https://golang.org/doc/install or doc/install.html for more details.