Skip to content

Add Iris v1 (nethttp) #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sudo: false
language: go
go:
- 1.4
- 1.6
- tip
766 changes: 471 additions & 295 deletions README.md

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,14 @@ func BenchmarkHttpTreeMux_Param(b *testing.B) {
r, _ := http.NewRequest("GET", "/user/gordon", nil)
benchRequest(b, router, r)
}

func BenchmarkIris_Param(b *testing.B) {
router := loadIrisSingle("GET", "/user/:name", irisHandler)

r, _ := http.NewRequest("GET", "/user/gordon", nil)
benchRequest(b, router, r)
}

func BenchmarkKocha_Param(b *testing.B) {
handler := new(kochaHandler)
router := loadKochaSingle(
Expand Down Expand Up @@ -373,6 +381,12 @@ func BenchmarkHttpTreeMux_Param5(b *testing.B) {
r, _ := http.NewRequest("GET", fiveRoute, nil)
benchRequest(b, router, r)
}
func BenchmarkIris_Param5(b *testing.B) {
router := loadIrisSingle("GET", fiveColon, irisHandler)

r, _ := http.NewRequest("GET", fiveRoute, nil)
benchRequest(b, router, r)
}
func BenchmarkKocha_Param5(b *testing.B) {
handler := new(kochaHandler)
router := loadKochaSingle(
Expand Down Expand Up @@ -559,6 +573,12 @@ func BenchmarkHttpTreeMux_Param20(b *testing.B) {
r, _ := http.NewRequest("GET", twentyRoute, nil)
benchRequest(b, router, r)
}
func BenchmarIris_Param20(b *testing.B) {
router := loadIrisSingle("GET", twentyColon, irisHandler)

r, _ := http.NewRequest("GET", twentyRoute, nil)
benchRequest(b, router, r)
}
func BenchmarkKocha_Param20(b *testing.B) {
handler := new(kochaHandler)
router := loadKochaSingle(
Expand Down Expand Up @@ -741,6 +761,13 @@ func BenchmarkHttpTreeMux_ParamWrite(b *testing.B) {
r, _ := http.NewRequest("GET", "/user/gordon", nil)
benchRequest(b, router, r)
}
func BenchmarkIris_ParamWrite(b *testing.B) {
router := loadIrisSingle("GET", "/user/:name", irisHandlerWrite)

r, _ := http.NewRequest("GET", "/user/gordon", nil)
benchRequest(b, router, r)
}

func BenchmarkKocha_ParamWrite(b *testing.B) {
handler := new(kochaHandler)
router := loadKochaSingle(
Expand Down
596 changes: 596 additions & 0 deletions full_all_benchmark.md

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ var (
githubGorillaMux http.Handler
githubHttpRouter http.Handler
githubHttpTreeMux http.Handler
githubIris http.Handler
githubKocha http.Handler
githubLARS http.Handler
githubMacaron http.Handler
Expand Down Expand Up @@ -353,6 +354,9 @@ func init() {
calcMem("HttpTreeMux", func() {
githubHttpTreeMux = loadHttpTreeMux(githubAPI)
})
calcMem("Iris", func() {
githubIris = loadIris(githubAPI)
})
calcMem("Kocha", func() {
githubKocha = loadKocha(githubAPI)
})
Expand Down Expand Up @@ -460,6 +464,10 @@ func BenchmarkHttpTreeMux_GithubStatic(b *testing.B) {
req, _ := http.NewRequest("GET", "/user/repos", nil)
benchRequest(b, githubHttpTreeMux, req)
}
func BenchmarkIris_GithubStatic(b *testing.B) {
req, _ := http.NewRequest("GET", "/user/repos", nil)
benchRequest(b, githubIris, req)
}
func BenchmarkKocha_GithubStatic(b *testing.B) {
req, _ := http.NewRequest("GET", "/user/repos", nil)
benchRequest(b, githubKocha, req)
Expand Down Expand Up @@ -579,6 +587,10 @@ func BenchmarkHttpTreeMux_GithubParam(b *testing.B) {
req, _ := http.NewRequest("GET", "/repos/julienschmidt/httprouter/stargazers", nil)
benchRequest(b, githubHttpTreeMux, req)
}
func BenchmarkIris_GithubParam(b *testing.B) {
req, _ := http.NewRequest("GET", "/repos/julienschmidt/httprouter/stargazers", nil)
benchRequest(b, githubIris, req)
}
func BenchmarkKocha_GithubParam(b *testing.B) {
req, _ := http.NewRequest("GET", "/repos/julienschmidt/httprouter/stargazers", nil)
benchRequest(b, githubKocha, req)
Expand Down Expand Up @@ -683,6 +695,9 @@ func BenchmarkHttpRouter_GithubAll(b *testing.B) {
func BenchmarkHttpTreeMux_GithubAll(b *testing.B) {
benchRoutes(b, githubHttpTreeMux, githubAPI)
}
func BenchmarkIris_GithubAll(b *testing.B) {
benchRoutes(b, githubIris, githubAPI)
}
func BenchmarkKocha_GithubAll(b *testing.B) {
benchRoutes(b, githubKocha, githubAPI)
}
Expand Down
31 changes: 31 additions & 0 deletions githuball.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
```
BenchmarkAce_GithubAll 10000 121206 ns/op 13792 B/op 167 allocs/op
BenchmarkBear_GithubAll 10000 348919 ns/op 86448 B/op 943 allocs/op
BenchmarkBeego_GithubAll 5000 296816 ns/op 16608 B/op 524 allocs/op
BenchmarkBone_GithubAll 500 2502143 ns/op 548736 B/op 7241 allocs/op
BenchmarkDenco_GithubAll 20000 99705 ns/op 20224 B/op 167 allocs/op
BenchmarkEcho_GithubAll 30000 45469 ns/op 0 B/op 0 allocs/op
BenchmarkGin_GithubAll 50000 39402 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_GithubAll 5000 446025 ns/op 131656 B/op 1686 allocs/op
BenchmarkGoji_GithubAll 3000 547698 ns/op 56112 B/op 334 allocs/op
BenchmarkGojiv2_GithubAll 2000 763043 ns/op 118864 B/op 3103 allocs/op
BenchmarkGoJsonRest_GithubAll 5000 538030 ns/op 134371 B/op 2737 allocs/op
BenchmarkGoRestful_GithubAll 100 14870850 ns/op 837832 B/op 6913 allocs/op
BenchmarkGorillaMux_GithubAll 200 6690383 ns/op 144464 B/op 1588 allocs/op
BenchmarkHttpRouter_GithubAll 20000 65653 ns/op 13792 B/op 167 allocs/op
BenchmarkHttpTreeMux_GithubAll 10000 215312 ns/op 65856 B/op 671 allocs/op
BenchmarkIris_GithubAll 100000 20731 ns/op 0 B/op 0 allocs/op
BenchmarkKocha_GithubAll 10000 167209 ns/op 23304 B/op 843 allocs/op
BenchmarkLARS_GithubAll 30000 41069 ns/op 0 B/op 0 allocs/op
BenchmarkMacaron_GithubAll 2000 665038 ns/op 201138 B/op 1803 allocs/op
BenchmarkMartini_GithubAll 300 5433644 ns/op 228213 B/op 2483 allocs/op
BenchmarkPat_GithubAll 300 4210240 ns/op 1499569 B/op 27435 allocs/op
BenchmarkPossum_GithubAll 10000 255114 ns/op 84448 B/op 609 allocs/op
BenchmarkR2router_GithubAll 10000 237113 ns/op 77328 B/op 979 allocs/op
BenchmarkRevel_GithubAll 2000 1150565 ns/op 337424 B/op 5512 allocs/op
BenchmarkRivet_GithubAll 20000 96555 ns/op 16272 B/op 167 allocs/op
BenchmarkTango_GithubAll 5000 417423 ns/op 87075 B/op 2267 allocs/op
BenchmarkTigerTonic_GithubAll 2000 994556 ns/op 233680 B/op 5035 allocs/op
BenchmarkTraffic_GithubAll 200 7770444 ns/op 2659331 B/op 21848 allocs/op
BenchmarkVulcan_GithubAll 5000 292216 ns/op 19894 B/op 609 allocs/op
```
31 changes: 31 additions & 0 deletions githubparam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
```
BenchmarkAce_GithubParam 2000000 584 ns/op 96 B/op 1 allocs/op
BenchmarkBear_GithubParam 1000000 1628 ns/op 496 B/op 5 allocs/op
BenchmarkBeego_GithubParam 1000000 1667 ns/op 192 B/op 4 allocs/op
BenchmarkBone_GithubParam 300000 6553 ns/op 1456 B/op 16 allocs/op
BenchmarkDenco_GithubParam 3000000 525 ns/op 128 B/op 1 allocs/op
BenchmarkEcho_GithubParam 10000000 186 ns/op 0 B/op 0 allocs/op
BenchmarkGin_GithubParam 10000000 184 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_GithubParam 1000000 2264 ns/op 712 B/op 9 allocs/op
BenchmarkGoji_GithubParam 1000000 1355 ns/op 336 B/op 2 allocs/op
BenchmarkGojiv2_GithubParam 1000000 1707 ns/op 256 B/op 7 allocs/op
BenchmarkGoJsonRest_GithubParam 1000000 2794 ns/op 713 B/op 14 allocs/op
BenchmarkGoRestful_GithubParam 10000 134707 ns/op 3016 B/op 31 allocs/op
BenchmarkGorillaMux_GithubParam 200000 11270 ns/op 768 B/op 8 allocs/op
BenchmarkHttpRouter_GithubParam 5000000 367 ns/op 96 B/op 1 allocs/op
BenchmarkHttpTreeMux_GithubParam 1000000 1198 ns/op 384 B/op 4 allocs/op
BenchmarkIris_GithubParam 30000000 49.3 ns/op 0 B/op 0 allocs/op
BenchmarkKocha_GithubParam 2000000 872 ns/op 128 B/op 5 allocs/op
BenchmarkLARS_GithubParam 10000000 189 ns/op 0 B/op 0 allocs/op
BenchmarkMacaron_GithubParam 1000000 3210 ns/op 1040 B/op 9 allocs/op
BenchmarkMartini_GithubParam 200000 13075 ns/op 1136 B/op 11 allocs/op
BenchmarkPat_GithubParam 200000 8415 ns/op 2464 B/op 48 allocs/op
BenchmarkPossum_GithubParam 1000000 1893 ns/op 560 B/op 6 allocs/op
BenchmarkR2router_GithubParam 1000000 1271 ns/op 432 B/op 5 allocs/op
BenchmarkRevel_GithubParam 200000 6570 ns/op 1744 B/op 28 allocs/op
BenchmarkRivet_GithubParam 3000000 554 ns/op 96 B/op 1 allocs/op
BenchmarkTango_GithubParam 1000000 2423 ns/op 480 B/op 12 allocs/op
BenchmarkTigerTonic_GithubParam 300000 6103 ns/op 1408 B/op 22 allocs/op
BenchmarkTraffic_GithubParam 100000 20411 ns/op 5992 B/op 52 allocs/op
BenchmarkVulcan_GithubParam 1000000 1848 ns/op 98 B/op 3 allocs/op
```
31 changes: 31 additions & 0 deletions githubstatic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
```
BenchmarkAce_GithubStatic 10000000 223 ns/op 0 B/op 0 allocs/op
BenchmarkBear_GithubStatic 2000000 613 ns/op 120 B/op 3 allocs/op
BenchmarkBeego_GithubStatic 1000000 1173 ns/op 64 B/op 4 allocs/op
BenchmarkBone_GithubStatic 100000 14740 ns/op 2880 B/op 60 allocs/op
BenchmarkDenco_GithubStatic 30000000 46.8 ns/op 0 B/op 0 allocs/op
BenchmarkEcho_GithubStatic 20000000 111 ns/op 0 B/op 0 allocs/op
BenchmarkGin_GithubStatic 20000000 114 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_GithubStatic 1000000 1140 ns/op 296 B/op 5 allocs/op
BenchmarkGoji_GithubStatic 5000000 260 ns/op 0 B/op 0 allocs/op
BenchmarkGojiv2_GithubStatic 2000000 810 ns/op 160 B/op 4 allocs/op
BenchmarkGoRestful_GithubStatic 30000 43835 ns/op 3720 B/op 32 allocs/op
BenchmarkGoJsonRest_GithubStatic 1000000 1501 ns/op 329 B/op 11 allocs/op
BenchmarkGorillaMux_GithubStatic 100000 20281 ns/op 448 B/op 7 allocs/op
BenchmarkHttpRouter_GithubStatic 30000000 56.5 ns/op 0 B/op 0 allocs/op
BenchmarkHttpTreeMux_GithubStatic 20000000 66.5 ns/op 0 B/op 0 allocs/op
BenchmarkIris_GithubStatic 30000000 48.5 ns/op 0 B/op 0 allocs/op
BenchmarkKocha_GithubStatic 20000000 76.2 ns/op 0 B/op 0 allocs/op
BenchmarkLARS_GithubStatic 20000000 109 ns/op 0 B/op 0 allocs/op
BenchmarkMacaron_GithubStatic 1000000 2751 ns/op 752 B/op 8 allocs/op
BenchmarkMartini_GithubStatic 100000 15170 ns/op 784 B/op 10 allocs/op
BenchmarkPat_GithubStatic 100000 12500 ns/op 3648 B/op 76 allocs/op
BenchmarkPossum_GithubStatic 1000000 1338 ns/op 416 B/op 3 allocs/op
BenchmarkR2router_GithubStatic 2000000 672 ns/op 144 B/op 4 allocs/op
BenchmarkRevel_GithubStatic 500000 4906 ns/op 1248 B/op 23 allocs/op
BenchmarkRivet_GithubStatic 10000000 121 ns/op 0 B/op 0 allocs/op
BenchmarkTango_GithubStatic 1000000 1620 ns/op 256 B/op 9 allocs/op
BenchmarkTigerTonic_GithubStatic 5000000 350 ns/op 48 B/op 1 allocs/op
BenchmarkTraffic_GithubStatic 30000 55736 ns/op 18904 B/op 148 allocs/op
BenchmarkVulcan_GithubStatic 1000000 1266 ns/op 98 B/op 3 allocs/op
```
31 changes: 31 additions & 0 deletions gplus2params.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
```
BenchmarkAce_GPlus2Params 3000000 465 ns/op 64 B/op 1 allocs/op
BenchmarkBear_GPlus2Params 1000000 1410 ns/op 496 B/op 5 allocs/op
BenchmarkBeego_GPlus2Params 1000000 1753 ns/op 256 B/op 4 allocs/op
BenchmarkBone_GPlus2Params 1000000 2846 ns/op 736 B/op 7 allocs/op
BenchmarkDenco_GPlus2Params 5000000 407 ns/op 64 B/op 1 allocs/op
BenchmarkEcho_GPlus2Params 10000000 166 ns/op 0 B/op 0 allocs/op
BenchmarkGin_GPlus2Params 10000000 148 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_GPlus2Params 1000000 2112 ns/op 712 B/op 9 allocs/op
BenchmarkGoji_GPlus2Params 1000000 1202 ns/op 336 B/op 2 allocs/op
BenchmarkGojiv2_GPlus2Params 1000000 1796 ns/op 256 B/op 8 allocs/op
BenchmarkGoJsonRest_GPlus2Params 1000000 2628 ns/op 713 B/op 14 allocs/op
BenchmarkGoRestful_GPlus2Params 100000 18971 ns/op 2920 B/op 31 allocs/op
BenchmarkGorillaMux_GPlus2Params 200000 8545 ns/op 768 B/op 8 allocs/op
BenchmarkHttpRouter_GPlus2Params 5000000 269 ns/op 64 B/op 1 allocs/op
BenchmarkHttpTreeMux_GPlus2Params 1000000 1108 ns/op 384 B/op 4 allocs/op
BenchmarkIris_GPlus2Params 30000000 53.3 ns/op 0 B/op 0 allocs/op
BenchmarkKocha_GPlus2Params 2000000 818 ns/op 128 B/op 5 allocs/op
BenchmarkLARS_GPlus2Params 10000000 149 ns/op 0 B/op 0 allocs/op
BenchmarkMacaron_GPlus2Params 1000000 2937 ns/op 1040 B/op 9 allocs/op
BenchmarkMartini_GPlus2Params 200000 13015 ns/op 1232 B/op 15 allocs/op
BenchmarkPat_GPlus2Params 200000 6500 ns/op 2256 B/op 34 allocs/op
BenchmarkPossum_GPlus2Params 1000000 1681 ns/op 560 B/op 6 allocs/op
BenchmarkR2router_GPlus2Params 1000000 1162 ns/op 432 B/op 5 allocs/op
BenchmarkRevel_GPlus2Params 500000 5910 ns/op 1760 B/op 28 allocs/op
BenchmarkRivet_GPlus2Params 5000000 411 ns/op 96 B/op 1 allocs/op
BenchmarkTango_GPlus2Params 1000000 1874 ns/op 448 B/op 11 allocs/op
BenchmarkTigerTonic_GPlus2Params 500000 5584 ns/op 1456 B/op 22 allocs/op
BenchmarkTraffic_GPlus2Params 200000 12500 ns/op 3272 B/op 31 allocs/op
BenchmarkVulcan_GPlus2Params 1000000 1486 ns/op 98 B/op 3 allocs/op
```
19 changes: 19 additions & 0 deletions gplus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var (
gplusGorillaMux http.Handler
gplusHttpRouter http.Handler
gplusHttpTreeMux http.Handler
gplusIris http.Handler
gplusKocha http.Handler
gplusLARS http.Handler
gplusMacaron http.Handler
Expand Down Expand Up @@ -115,6 +116,9 @@ func init() {
calcMem("HttpTreeMux", func() {
gplusHttpTreeMux = loadHttpTreeMux(gplusAPI)
})
calcMem("Iris", func() {
gplusIris = loadIris(gplusAPI)
})
calcMem("Kocha", func() {
gplusKocha = loadKocha(gplusAPI)
})
Expand Down Expand Up @@ -222,6 +226,10 @@ func BenchmarkHttpTreeMux_GPlusStatic(b *testing.B) {
req, _ := http.NewRequest("GET", "/people", nil)
benchRequest(b, gplusHttpTreeMux, req)
}
func BenchmarkIris_GPlusStatic(b *testing.B) {
req, _ := http.NewRequest("GET", "/people", nil)
benchRequest(b, gplusIris, req)
}
func BenchmarkKocha_GPlusStatic(b *testing.B) {
req, _ := http.NewRequest("GET", "/people", nil)
benchRequest(b, gplusKocha, req)
Expand Down Expand Up @@ -341,6 +349,10 @@ func BenchmarkHttpTreeMux_GPlusParam(b *testing.B) {
req, _ := http.NewRequest("GET", "/people/118051310819094153327", nil)
benchRequest(b, gplusHttpTreeMux, req)
}
func BenchmarkIris_GPlusParam(b *testing.B) {
req, _ := http.NewRequest("GET", "/people/118051310819094153327", nil)
benchRequest(b, gplusIris, req)
}
func BenchmarkKocha_GPlusParam(b *testing.B) {
req, _ := http.NewRequest("GET", "/people/118051310819094153327", nil)
benchRequest(b, gplusKocha, req)
Expand Down Expand Up @@ -460,6 +472,10 @@ func BenchmarkHttpTreeMux_GPlus2Params(b *testing.B) {
req, _ := http.NewRequest("GET", "/people/118051310819094153327/activities/123456789", nil)
benchRequest(b, gplusHttpTreeMux, req)
}
func BenchmarkIris_GPlus2Params(b *testing.B) {
req, _ := http.NewRequest("GET", "/people/118051310819094153327/activities/123456789", nil)
benchRequest(b, gplusIris, req)
}
func BenchmarkKocha_GPlus2Params(b *testing.B) {
req, _ := http.NewRequest("GET", "/people/118051310819094153327/activities/123456789", nil)
benchRequest(b, gplusKocha, req)
Expand Down Expand Up @@ -564,6 +580,9 @@ func BenchmarkHttpRouter_GPlusAll(b *testing.B) {
func BenchmarkHttpTreeMux_GPlusAll(b *testing.B) {
benchRoutes(b, gplusHttpTreeMux, gplusAPI)
}
func BenchmarkIris_GPlusAll(b *testing.B) {
benchRoutes(b, gplusIris, gplusAPI)
}
func BenchmarkKocha_GPlusAll(b *testing.B) {
benchRoutes(b, gplusKocha, gplusAPI)
}
Expand Down
Loading