Skip to content

Instantly share code, notes, and snippets.

@pkieltyka
Last active January 3, 2017 22:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkieltyka/76a59d33492dd2732e691ad8c0b274a4 to your computer and use it in GitHub Desktop.
Save pkieltyka/76a59d33492dd2732e691ad8c0b274a4 to your computer and use it in GitHub Desktop.
github.com/pressly/chi v2 benchmark suite - using latest versions of each project as of Aug 1, 2016
$ go test -v -bench="Chi|HttpRouter|Goji|Martini|Gorilla|Gocraft|Beego|Gin" .
#GithubAPI Routes: 203
Beego: 165304 Bytes
Chi: 74056 Bytes
Gin: 52464 Bytes
GocraftWeb: 95720 Bytes
Goji: 86088 Bytes
GorillaMux: 1494864 Bytes
HttpRouter: 37464 Bytes
Martini: 556160 Bytes
#GPlusAPI Routes: 13
Beego: 11400 Bytes
Chi: 6824 Bytes
Gin: 3856 Bytes
GocraftWeb: 7496 Bytes
Goji: 2912 Bytes
GorillaMux: 71072 Bytes
HttpRouter: 2712 Bytes
Martini: 23936 Bytes
#ParseAPI Routes: 26
Beego: 21040 Bytes
Chi: 7488 Bytes
Gin: 6816 Bytes
GocraftWeb: 12800 Bytes
Goji: 5232 Bytes
GorillaMux: 122184 Bytes
HttpRouter: 4976 Bytes
Martini: 45952 Bytes
#Static Routes: 157
Beego: 103240 Bytes
Chi: 74816 Bytes
Gin: 30400 Bytes
GocraftWeb: 55464 Bytes
Goji: 27200 Bytes
GorillaMux: 668496 Bytes
HttpRouter: 21128 Bytes
Martini: 308784 Bytes
=== RUN TestRouters
--- PASS: TestRouters (0.98s)
BenchmarkBeego_Param 1000000 1853 ns/op 720 B/op 10 allocs/op
BenchmarkChi_Param 3000000 403 ns/op 240 B/op 1 allocs/op
BenchmarkGin_Param 20000000 72.9 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_Param 1000000 1407 ns/op 648 B/op 8 allocs/op
BenchmarkGoji_Param 2000000 834 ns/op 336 B/op 2 allocs/op
BenchmarkGorillaMux_Param 500000 2806 ns/op 992 B/op 10 allocs/op
BenchmarkHttpRouter_Param 20000000 103 ns/op 32 B/op 1 allocs/op
BenchmarkMartini_Param 300000 5154 ns/op 1104 B/op 11 allocs/op
BenchmarkBeego_Param5 500000 2640 ns/op 992 B/op 13 allocs/op
BenchmarkChi_Param5 3000000 551 ns/op 240 B/op 1 allocs/op
BenchmarkGin_Param5 20000000 110 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_Param5 1000000 2172 ns/op 920 B/op 11 allocs/op
BenchmarkGoji_Param5 2000000 950 ns/op 336 B/op 2 allocs/op
BenchmarkGorillaMux_Param5 300000 3683 ns/op 1056 B/op 10 allocs/op
BenchmarkHttpRouter_Param5 5000000 281 ns/op 160 B/op 1 allocs/op
BenchmarkMartini_Param5 300000 5945 ns/op 1232 B/op 11 allocs/op
BenchmarkBeego_Param20 200000 7859 ns/op 3868 B/op 17 allocs/op
BenchmarkChi_Param20 1000000 1164 ns/op 240 B/op 1 allocs/op
BenchmarkGin_Param20 5000000 248 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_Param20 200000 7465 ns/op 3795 B/op 15 allocs/op
BenchmarkGoji_Param20 500000 2855 ns/op 1247 B/op 2 allocs/op
BenchmarkGorillaMux_Param20 200000 8569 ns/op 3163 B/op 12 allocs/op
BenchmarkHttpRouter_Param20 2000000 823 ns/op 640 B/op 1 allocs/op
BenchmarkMartini_Param20 200000 10591 ns/op 3595 B/op 13 allocs/op
BenchmarkBeego_ParamWrite 1000000 1762 ns/op 728 B/op 11 allocs/op
BenchmarkChi_ParamWrite 3000000 438 ns/op 240 B/op 1 allocs/op
BenchmarkGin_ParamWrite 10000000 158 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_ParamWrite 1000000 1405 ns/op 656 B/op 9 allocs/op
BenchmarkGoji_ParamWrite 2000000 715 ns/op 336 B/op 2 allocs/op
BenchmarkGorillaMux_ParamWrite 500000 2565 ns/op 1000 B/op 11 allocs/op
BenchmarkHttpRouter_ParamWrite 10000000 148 ns/op 32 B/op 1 allocs/op
BenchmarkMartini_ParamWrite 200000 6129 ns/op 1208 B/op 15 allocs/op
BenchmarkBeego_GithubStatic 1000000 1142 ns/op 368 B/op 7 allocs/op
BenchmarkChi_GithubStatic 3000000 407 ns/op 240 B/op 1 allocs/op
BenchmarkGin_GithubStatic 20000000 78.6 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_GithubStatic 2000000 745 ns/op 296 B/op 5 allocs/op
BenchmarkGoji_GithubStatic 10000000 215 ns/op 0 B/op 0 allocs/op
BenchmarkGorillaMux_GithubStatic 100000 14630 ns/op 688 B/op 9 allocs/op
BenchmarkHttpRouter_GithubStatic 30000000 46.0 ns/op 0 B/op 0 allocs/op
BenchmarkMartini_GithubStatic 100000 12633 ns/op 784 B/op 10 allocs/op
BenchmarkBeego_GithubParam 1000000 1913 ns/op 784 B/op 11 allocs/op
BenchmarkChi_GithubParam 3000000 501 ns/op 240 B/op 1 allocs/op
BenchmarkGin_GithubParam 10000000 120 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_GithubParam 1000000 1452 ns/op 712 B/op 9 allocs/op
BenchmarkGoji_GithubParam 2000000 903 ns/op 336 B/op 2 allocs/op
BenchmarkGorillaMux_GithubParam 200000 8243 ns/op 1008 B/op 10 allocs/op
BenchmarkHttpRouter_GithubParam 10000000 217 ns/op 96 B/op 1 allocs/op
BenchmarkMartini_GithubParam 200000 10032 ns/op 1136 B/op 11 allocs/op
BenchmarkBeego_GithubAll 5000 381690 ns/op 146272 B/op 2092 allocs/op
BenchmarkChi_GithubAll 20000 100586 ns/op 48721 B/op 203 allocs/op
BenchmarkGin_GithubAll 50000 24691 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_GithubAll 5000 294794 ns/op 131656 B/op 1686 allocs/op
BenchmarkGoji_GithubAll 3000 378554 ns/op 56113 B/op 334 allocs/op
BenchmarkGorillaMux_GithubAll 300 5234001 ns/op 193184 B/op 1994 allocs/op
BenchmarkHttpRouter_GithubAll 50000 37410 ns/op 13792 B/op 167 allocs/op
BenchmarkMartini_GithubAll 300 4303284 ns/op 228215 B/op 2483 allocs/op
BenchmarkBeego_GPlusStatic 2000000 867 ns/op 352 B/op 7 allocs/op
BenchmarkChi_GPlusStatic 5000000 265 ns/op 240 B/op 1 allocs/op
BenchmarkGin_GPlusStatic 20000000 63.5 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_GPlusStatic 3000000 583 ns/op 280 B/op 5 allocs/op
BenchmarkGoji_GPlusStatic 10000000 155 ns/op 0 B/op 0 allocs/op
BenchmarkGorillaMux_GPlusStatic 1000000 1164 ns/op 688 B/op 9 allocs/op
BenchmarkHttpRouter_GPlusStatic 50000000 28.2 ns/op 0 B/op 0 allocs/op
BenchmarkMartini_GPlusStatic 500000 3809 ns/op 784 B/op 10 allocs/op
BenchmarkBeego_GPlusParam 1000000 1480 ns/op 720 B/op 10 allocs/op
BenchmarkChi_GPlusParam 5000000 306 ns/op 240 B/op 1 allocs/op
BenchmarkGin_GPlusParam 20000000 82.2 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_GPlusParam 1000000 1040 ns/op 648 B/op 8 allocs/op
BenchmarkGoji_GPlusParam 3000000 548 ns/op 336 B/op 2 allocs/op
BenchmarkGorillaMux_GPlusParam 500000 2685 ns/op 992 B/op 10 allocs/op
BenchmarkHttpRouter_GPlusParam 10000000 135 ns/op 64 B/op 1 allocs/op
BenchmarkMartini_GPlusParam 300000 4647 ns/op 1104 B/op 11 allocs/op
BenchmarkBeego_GPlus2Params 1000000 1800 ns/op 784 B/op 11 allocs/op
BenchmarkChi_GPlus2Params 5000000 369 ns/op 240 B/op 1 allocs/op
BenchmarkGin_GPlus2Params 20000000 102 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_GPlus2Params 1000000 1338 ns/op 712 B/op 9 allocs/op
BenchmarkGoji_GPlus2Params 2000000 792 ns/op 336 B/op 2 allocs/op
BenchmarkGorillaMux_GPlus2Params 200000 6367 ns/op 1008 B/op 10 allocs/op
BenchmarkHttpRouter_GPlus2Params 10000000 156 ns/op 64 B/op 1 allocs/op
BenchmarkMartini_GPlus2Params 200000 9679 ns/op 1232 B/op 15 allocs/op
BenchmarkBeego_GPlusAll 100000 19766 ns/op 8976 B/op 129 allocs/op
BenchmarkChi_GPlusAll 300000 4431 ns/op 3120 B/op 13 allocs/op
BenchmarkGin_GPlusAll 1000000 1111 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_GPlusAll 100000 14158 ns/op 8040 B/op 103 allocs/op
BenchmarkGoji_GPlusAll 200000 7877 ns/op 3696 B/op 22 allocs/op
BenchmarkGorillaMux_GPlusAll 30000 42753 ns/op 12368 B/op 128 allocs/op
BenchmarkHttpRouter_GPlusAll 1000000 1579 ns/op 640 B/op 11 allocs/op
BenchmarkMartini_GPlusAll 20000 75058 ns/op 14448 B/op 165 allocs/op
BenchmarkBeego_ParseStatic 2000000 933 ns/op 368 B/op 7 allocs/op
BenchmarkChi_ParseStatic 5000000 260 ns/op 240 B/op 1 allocs/op
BenchmarkGin_ParseStatic 20000000 63.4 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_ParseStatic 3000000 567 ns/op 296 B/op 5 allocs/op
BenchmarkGoji_ParseStatic 10000000 195 ns/op 0 B/op 0 allocs/op
BenchmarkGorillaMux_ParseStatic 1000000 1961 ns/op 688 B/op 9 allocs/op
BenchmarkHttpRouter_ParseStatic 50000000 32.2 ns/op 0 B/op 0 allocs/op
BenchmarkMartini_ParseStatic 500000 4163 ns/op 784 B/op 10 allocs/op
BenchmarkBeego_ParseParam 1000000 1428 ns/op 736 B/op 10 allocs/op
BenchmarkChi_ParseParam 5000000 278 ns/op 240 B/op 1 allocs/op
BenchmarkGin_ParseParam 20000000 67.1 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_ParseParam 1000000 1027 ns/op 664 B/op 8 allocs/op
BenchmarkGoji_ParseParam 2000000 611 ns/op 336 B/op 2 allocs/op
BenchmarkGorillaMux_ParseParam 1000000 2170 ns/op 992 B/op 10 allocs/op
BenchmarkHttpRouter_ParseParam 20000000 122 ns/op 64 B/op 1 allocs/op
BenchmarkMartini_ParseParam 300000 4593 ns/op 1104 B/op 11 allocs/op
BenchmarkBeego_Parse2Params 1000000 1676 ns/op 784 B/op 11 allocs/op
BenchmarkChi_Parse2Params 5000000 319 ns/op 240 B/op 1 allocs/op
BenchmarkGin_Parse2Params 20000000 81.0 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_Parse2Params 1000000 1217 ns/op 712 B/op 9 allocs/op
BenchmarkGoji_Parse2Params 2000000 626 ns/op 336 B/op 2 allocs/op
BenchmarkGorillaMux_Parse2Params 1000000 2464 ns/op 1008 B/op 10 allocs/op
BenchmarkHttpRouter_Parse2Params 10000000 136 ns/op 64 B/op 1 allocs/op
BenchmarkMartini_Parse2Params 300000 4580 ns/op 1136 B/op 11 allocs/op
BenchmarkBeego_ParseAll 50000 34159 ns/op 15600 B/op 233 allocs/op
BenchmarkChi_ParseAll 200000 8373 ns/op 6240 B/op 26 allocs/op
BenchmarkGin_ParseAll 1000000 1964 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_ParseAll 50000 24895 ns/op 13728 B/op 181 allocs/op
BenchmarkGoji_ParseAll 100000 13362 ns/op 5376 B/op 32 allocs/op
BenchmarkGorillaMux_ParseAll 20000 103348 ns/op 22800 B/op 250 allocs/op
BenchmarkHttpRouter_ParseAll 1000000 2438 ns/op 640 B/op 16 allocs/op
BenchmarkMartini_ParseAll 10000 146202 ns/op 25600 B/op 276 allocs/op
BenchmarkBeego_StaticAll 10000 167557 ns/op 57744 B/op 1099 allocs/op
BenchmarkChi_StaticAll 20000 57366 ns/op 37680 B/op 157 allocs/op
BenchmarkGin_StaticAll 100000 17116 ns/op 0 B/op 0 allocs/op
BenchmarkGocraftWeb_StaticAll 10000 105267 ns/op 46440 B/op 785 allocs/op
BenchmarkGoji_StaticAll 30000 47022 ns/op 0 B/op 0 allocs/op
BenchmarkGorillaMux_StaticAll 1000 1440190 ns/op 108112 B/op 1421 allocs/op
BenchmarkHttpRouter_StaticAll 100000 11556 ns/op 0 B/op 0 allocs/op
BenchmarkMartini_StaticAll 1000 1973009 ns/op 132818 B/op 2178 allocs/op
PASS
ok github.com/pkieltyka/go-http-routing-benchmark 232.623s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment