{"push_id":2662257594,"size":3,"distinct_size":3,"ref":"refs/heads/master","head":"6136bc6c7ee7a73de9c66ed4a23e1df08bad2121","before":"5fcd2a92dad107280fd716ce7e63c086bcde1310","commits":[{"sha":"87d536c00120e6631cd7e6ff100739858e07e002","author":{"name":"田欧","email":"8cf465b1e021f8e7aaf1fa07c9cba681c67d044e@gmail.com"},"message":"utils:  use strings.Split instead of strings.IndexByte (#1400)\n\nAnd I test them benchmark:\r\n\r\ncode:\r\n\r\n```go\r\n# stringsbench.go\r\npackage stringsbench\r\n\r\nimport \"strings\"\r\n\r\nfunc index(part string) string {\r\n\tif index := strings.IndexByte(part, ';'); index >= 0 {\r\n\t\tif part := strings.TrimSpace(strings.Split(part, \";\")[0]); part != \"\" {\r\n\t\t\treturn part[0:index]\r\n\t\t}\r\n\t}\r\n\treturn \"\"\r\n}\r\n\r\nfunc split(part string) string {\r\n\treturn strings.Split(part, \";\")[0]\r\n}\r\n```\r\n\r\n```go\r\n# stringsbench_test.go\r\npackage stringsbench\r\n\r\nimport (\r\n\t\"testing\"\r\n)\r\n\r\nfunc BenchmarkIndex(b *testing.B) {\r\n\tb.RunParallel(func(pb *testing.PB) {\r\n\t\tfor pb.Next() {\r\n\t\t\tindex(\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\")\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunc BenchmarkSplit(b *testing.B) {\r\n\tb.RunParallel(func(pb *testing.PB) {\r\n\t\tfor pb.Next() {\r\n\t\t\tsplit(\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\")\r\n\t\t}\r\n\t})\r\n}\r\n```\r\n\r\nAnd the result:\r\n\r\n```shell\r\n➜  strings go test --bench=.\r\ngoos: darwin\r\ngoarch: amd64\r\nBenchmarkIndex-8   \t30000000\t        46.1 ns/op\r\nBenchmarkSplit-8   \t50000000\t        35.9 ns/op\r\nPASS\r\nok  \t_/Users/tianou/strings\t3.271s\r\n➜  strings go test --bench=.\r\ngoos: darwin\r\ngoarch: amd64\r\nBenchmarkIndex-8   \t30000000\t        44.2 ns/op\r\nBenchmarkSplit-8   \t50000000\t        34.7 ns/op\r\nPASS\r\nok  \t_/Users/tianou/strings\t3.156s\r\n➜  strings go test --bench=.\r\ngoos: darwin\r\ngoarch: amd64\r\nBenchmarkIndex-8   \t30000000\t        45.6 ns/op\r\nBenchmarkSplit-8   \t50000000\t        35.3 ns/op\r\nPASS\r\nok  \t_/Users/tianou/strings\t3.230s\r\n```","distinct":true,"url":"https://api.github.com/repos/AcoNCodes/gin/commits/87d536c00120e6631cd7e6ff100739858e07e002"},{"sha":"bf85b32c1d11dcfa2202daa6d1ad2addae2d1619","author":{"name":"htobenothing","email":"bb3528f72ffadb1a244fc9b0b536343f1130ffa3@gmail.com"},"message":"Add Pusher() function for support http2 server push (#1273)\n\ngin already support http2, while previously not support server push.\r\nAdd Pusher() function to extend the ResponseWriter interface.\r\n\r\n```golang\r\n// get http.Pusher\r\n if pusher := c.Writer.Pusher(); pusher != nil {\r\n     // use pusher.Push() to do server push\r\n}\r\n```\r\n<img width=\"881\" alt=\"screen shot 2018-03-07 at 11 20 49 pm\" src=\"https://user-images.githubusercontent.com/16014993/37100619-680c00c6-225e-11e8-9352-76ec3bd62894.png\">","distinct":true,"url":"https://api.github.com/repos/AcoNCodes/gin/commits/bf85b32c1d11dcfa2202daa6d1ad2addae2d1619"},{"sha":"6136bc6c7ee7a73de9c66ed4a23e1df08bad2121","author":{"name":"AcoNCodes","email":"6806dc704e1cd23e1ba385b70da89cca095a83f1@gmail.com"},"message":"Merge branch 'master' into master","distinct":true,"url":"https://api.github.com/repos/AcoNCodes/gin/commits/6136bc6c7ee7a73de9c66ed4a23e1df08bad2121"}]}
{"actor":{"display_login":"AcoNCodes"}}