2183 Commits

Author SHA1 Message Date
c91d17acf1 Benchmark encode and cut encoding inefficiency.
This commit introduces the first microbenchmark for grpc, wherein
`encode` is benchmarked according to message size.  A conclusion of
the benchmark is that the removal of type switching found in
`binary.Write`, which is used in `encode` produces the following
encoding time and memory allocation footprint:

```
$ # Return to previous commit but benchmark.
$ go test ./... -test.bench="Benchmark*" > /tmp/before
$ # Return to working copy.
$ go test ./... -test.bench="Benchmark*" > /tmp/after
$ benchcmp /tmp/before /tmp/after
benchmark                 old ns/op     new ns/op     delta
BenchmarkEncode1B         1282          936           -26.99%
BenchmarkEncode1KiB       4865          4184          -14.00%
BenchmarkEncode8KiB       22686         21560         -4.96%
BenchmarkEncode64KiB      134451        116762        -13.16%
BenchmarkEncode512KiB     514044        361224        -29.73%
BenchmarkEncode1MiB       767096        636725        -17.00%

benchmark                 old MB/s     new MB/s     speedup
BenchmarkEncode1B         6.24         8.55         1.37x
BenchmarkEncode1KiB       212.11       246.63       1.16x
BenchmarkEncode8KiB       361.46       380.33       1.05x
BenchmarkEncode64KiB      487.50       561.35       1.15x
BenchmarkEncode512KiB     1019.94      1451.45      1.42x
BenchmarkEncode1MiB       1366.95      1646.84      1.20x

benchmark                 old allocs     new allocs     delta
BenchmarkEncode1B         6              3              -50.00%
BenchmarkEncode1KiB       8              5              -37.50%
BenchmarkEncode8KiB       8              5              -37.50%
BenchmarkEncode64KiB      8              5              -37.50%
BenchmarkEncode512KiB     8              5              -37.50%
BenchmarkEncode1MiB       8              5              -37.50%

benchmark                 old bytes     new bytes     delta
BenchmarkEncode1B         384           328           -14.58%
BenchmarkEncode1KiB       2816          2760          -1.99%
BenchmarkEncode8KiB       17283         17227         -0.32%
BenchmarkEncode64KiB      147856        147802        -0.04%
BenchmarkEncode512KiB     1065344       1065288       -0.01%
BenchmarkEncode1MiB       2113920       2113864       -0.00%
```

..., which is apropos of the comment in [encoding/binary]
(http://golang.org/pkg/encoding/binary), wherein ...

> This package favors simplicity over efficiency.

... is stated.

If `encode` is deemed to need further memory efficiencies, a mechanism
whereby a `proto.Buffer` is retained may be warranted, which is why the
original TODO remains.  The proposed improvement in this change is
simple and low-hanging.

I did not want to introduce yet-another protocol buffer message for
tests, but the ones under ...

> interop/grpc_testing/test.proto
> test/grpc_testing/test.proto

... have a fundamental dependency on `grpc` package due to their
generated stubs, which produces a cycle in the imports if the benchmark
were to attempt to import them for profiling.  The newly created ...

> test/grpc_message/test.proto

... protocol buffer package has no generated RPC service stubs, which
means it can be imported into the `grpc` package root without cycle.
2015-03-03 09:42:00 +01:00
84451c554b Sync with upstream 2015-03-01 17:12:39 -08:00
46f39d3ebd Cosmetic updates to the route guide example 2015-03-01 17:05:46 -08:00
575a9b2af8 Merge pull request #86 from domesticmouse/patch-1
Minor typo
2015-03-01 12:36:16 -08:00
786d10d0a3 Minor typo 2015-02-28 14:29:36 +11:00
3606a18f7b fix server-side -> client-side cut-and-paste-o 2015-02-27 16:30:00 -05:00
62921e6780 fix typo 2015-02-27 13:12:27 -08:00
63953dd7e5 Merge pull request #83 from SebastianM/godoc
add godoc.org badge
2015-02-27 11:11:54 -08:00
17988fc724 Some edits/rewriting of Go tutorial 2015-02-27 16:47:51 +00:00
2b228c8c27 add godoc.org badge 2015-02-27 10:55:34 +01:00
333f8f218a Merge pull request #81 from mattn/fix-fatal
Use Fatalf instead
2015-02-26 19:02:38 -08:00
5c34a9df1a Merge pull request #82 from dsymonds/patch-1
Remove manual GOPATH manipulation.
2015-02-26 19:02:08 -08:00
bd7fb8d865 Remove manaul GOPATH manipulation.
Travis' Go setup already sets up a suitable `GOPATH`, so there's no need to do it manually.
2015-02-27 13:59:09 +11:00
9ca6e20632 Merge pull request #80 from dsymonds/patch-1
Remove explicit Go version from Travis config.
2015-02-26 18:57:26 -08:00
b76c21e4d0 Use Fatalf instead 2015-02-27 11:54:37 +09:00
a410c5f56b Update README.md 2015-02-26 18:52:24 -08:00
39d3ebf1a4 Remove explicit Go version from Travis config.
The `language: go` statement already selects the latest stable release of Go.
2015-02-27 13:50:55 +11:00
7570e322c5 Merge pull request #79 from iamqizhao/master
add route_guide.pb.go because it is required by travis
2015-02-26 18:48:02 -08:00
594d70fc4b add route_guide.pb.go because it is required by travis 2015-02-26 18:43:16 -08:00
6291363817 Merge pull request #78 from iamqizhao/master
add .travis.yml
2015-02-26 18:32:17 -08:00
5d3ee6a451 add .travis.yml 2015-02-26 18:30:54 -08:00
795f960c58 Merge pull request #77 from iamqizhao/master
remove a TODO
2015-02-26 18:21:40 -08:00
568c0e64bc remove a TODO 2015-02-26 18:19:47 -08:00
c494f0e1b3 Merge pull request #130 from iamqizhao/master
fix gotutorial (client)
2015-02-26 17:41:01 -08:00
a68bd01eac fix gotutorial (client) 2015-02-26 17:39:05 -08:00
a83164791b Update gotutorial.md 2015-02-27 01:17:18 +01:00
02795609e0 fix gotutorial (server part) 2015-02-26 16:11:10 -08:00
1bd636dd60 Merge pull request #74 from grpc/jayantkolhe-patch-2
Create PATENTS
2015-02-26 15:17:33 -08:00
2f789b40da Create PATENTS
Adding Patents Grant file
2015-02-26 15:10:08 -08:00
1932f7de8f Merge pull request #71 from iamqizhao/master
fix typo
2015-02-26 14:01:13 -08:00
07a87c63f2 fix typo 2015-02-26 13:56:10 -08:00
504abf38b0 update gotutorial a bit (contd) 2015-02-26 13:41:17 -08:00
2f9b60c8d8 update gotutorial a bit 2015-02-26 13:25:30 -08:00
f7d17351f7 Fix gotutorial 2015-02-26 09:54:05 -08:00
89071b275a Merge pull request #69 from grpc/jayantkolhe-patch-1
Update README.md
2015-02-26 09:41:11 -08:00
9ac8d7142c Update README.md
Adding link to go tutorial
2015-02-26 05:16:57 -08:00
9e1539115e Merge pull request #68 from dsymonds/patch-1
Fix typo.
2015-02-25 23:33:44 -08:00
7d51ed30d7 Fix typo. 2015-02-26 18:31:44 +11:00
4949382060 Merge pull request #67 from iamqizhao/master
rename the convenience function to set TLS creds
2015-02-25 23:00:13 -08:00
2b993cd479 rename the convenience function to set TLS creds 2015-02-25 22:57:07 -08:00
856702e6ca initial tutorial draft from @wonderfly. I only touched up a few places. Will have a full pass tonight or tomorrow. 2015-02-25 19:49:05 -08:00
d8e4b346c3 Merge pull request #66 from iamqizhao/master
Add auth readme
2015-02-25 19:16:13 -08:00
339ed4f767 add grpc-auth-support.md (GCE and JWT) 2015-02-25 19:10:13 -08:00
83497d8642 add grpc-auth-support.md (tls only) 2015-02-25 19:01:56 -08:00
87ce82d753 Merge branch 'master' of https://github.com/grpc/grpc-go 2015-02-25 18:53:51 -08:00
c5f55a615d revert 2015-02-25 18:53:11 -08:00
32527e92db Merge pull request #65 from grpc/revert-64-master
Revert "init serverName correctly"
2015-02-25 18:51:21 -08:00
fcb8e429c4 Revert "init serverName correctly" 2015-02-25 18:51:04 -08:00
5de4c2c381 Merge pull request #64 from iamqizhao/master
init serverName correctly
2015-02-25 18:49:31 -08:00
eebb1f0588 init serverName correctly 2015-02-25 18:48:21 -08:00