Skip to content

Instantly share code, notes, and snippets.

@pkieltyka
Last active November 6, 2015 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkieltyka/505b07b09f5c63e36ef5 to your computer and use it in GitHub Desktop.
Save pkieltyka/505b07b09f5c63e36ef5 to your computer and use it in GitHub Desktop.
github.com/pressly/chi benchmarks
Based on: https://github.com/pkieltyka/go-http-routing-benchmark
$ go test -v -bench="HttpRouter|Chi|Goji|Macaron|Martini|Gorilla|Gocraft|Beego" .
#GithubAPI Routes: 203
Beego: 167624 Bytes
Chi: 70728 Bytes
GocraftWeb: 89080 Bytes
Goji: 88392 Bytes
GorillaMux: 1496624 Bytes
HttpRouter: 38072 Bytes
Macaron: 128200 Bytes
Martini: 557440 Bytes
#GPlusAPI Routes: 13
Beego: 11480 Bytes
Chi: 6312 Bytes
GocraftWeb: 7064 Bytes
Goji: 3056 Bytes
GorillaMux: 71168 Bytes
HttpRouter: 2776 Bytes
Macaron: 8448 Bytes
Martini: 24000 Bytes
#ParseAPI Routes: 26
Beego: 21216 Bytes
Chi: 10568 Bytes
GocraftWeb: 12160 Bytes
Goji: 5456 Bytes
GorillaMux: 122280 Bytes
HttpRouter: 5040 Bytes
Macaron: 13232 Bytes
Martini: 45952 Bytes
#Static Routes: 157
Beego: 105112 Bytes
Chi: 40760 Bytes
GocraftWeb: 50904 Bytes
Goji: 27200 Bytes
GorillaMux: 668608 Bytes
HttpRouter: 21560 Bytes
Macaron: 34928 Bytes
Martini: 309104 Bytes
=== RUN TestRouters
--- PASS: TestRouters (1.10s)
PASS
BenchmarkBeego_Param 1000000 2053 ns/op 720 B/op 10 allocs/op
BenchmarkChi_Param 1000000 1026 ns/op 432 B/op 6 allocs/op
BenchmarkGocraftWeb_Param 1000000 1618 ns/op 648 B/op 8 allocs/op
BenchmarkGoji_Param 2000000 822 ns/op 336 B/op 2 allocs/op
BenchmarkGorillaMux_Param 500000 3020 ns/op 832 B/op 11 allocs/op
BenchmarkHttpRouter_Param 10000000 136 ns/op 32 B/op 1 allocs/op
BenchmarkMacaron_Param 500000 2739 ns/op 1040 B/op 9 allocs/op
BenchmarkMartini_Param 300000 4443 ns/op 1104 B/op 11 allocs/op
BenchmarkBeego_Param5 500000 3038 ns/op 992 B/op 13 allocs/op
BenchmarkChi_Param5 1000000 1563 ns/op 432 B/op 6 allocs/op
BenchmarkGocraftWeb_Param5 1000000 2534 ns/op 920 B/op 11 allocs/op
BenchmarkGoji_Param5 1000000 1068 ns/op 336 B/op 2 allocs/op
BenchmarkGorillaMux_Param5 200000 5361 ns/op 1088 B/op 19 allocs/op
BenchmarkHttpRouter_Param5 5000000 388 ns/op 160 B/op 1 allocs/op
BenchmarkMacaron_Param5 500000 3058 ns/op 1040 B/op 9 allocs/op
BenchmarkMartini_Param5 300000 5478 ns/op 1232 B/op 11 allocs/op
BenchmarkBeego_Param20 200000 9391 ns/op 3867 B/op 17 allocs/op
BenchmarkChi_Param20 200000 7167 ns/op 2283 B/op 8 allocs/op
BenchmarkGocraftWeb_Param20 200000 8740 ns/op 3795 B/op 15 allocs/op
BenchmarkGoji_Param20 500000 3352 ns/op 1247 B/op 2 allocs/op
BenchmarkGorillaMux_Param20 100000 13595 ns/op 3932 B/op 51 allocs/op
BenchmarkHttpRouter_Param20 1000000 1136 ns/op 640 B/op 1 allocs/op
BenchmarkMacaron_Param20 200000 7949 ns/op 2892 B/op 11 allocs/op
BenchmarkMartini_Param20 200000 11477 ns/op 3596 B/op 13 allocs/op
BenchmarkBeego_ParamWrite 1000000 2130 ns/op 736 B/op 11 allocs/op
BenchmarkChi_ParamWrite 1000000 1140 ns/op 448 B/op 7 allocs/op
BenchmarkGocraftWeb_ParamWrite 1000000 1726 ns/op 664 B/op 9 allocs/op
BenchmarkGoji_ParamWrite 2000000 867 ns/op 336 B/op 2 allocs/op
BenchmarkGorillaMux_ParamWrite 500000 3094 ns/op 832 B/op 11 allocs/op
BenchmarkHttpRouter_ParamWrite 10000000 183 ns/op 32 B/op 1 allocs/op
BenchmarkMacaron_ParamWrite 500000 3185 ns/op 1152 B/op 13 allocs/op
BenchmarkMartini_ParamWrite 300000 5017 ns/op 1216 B/op 15 allocs/op
BenchmarkBeego_GithubStatic 1000000 1360 ns/op 368 B/op 7 allocs/op
BenchmarkChi_GithubStatic 2000000 631 ns/op 144 B/op 5 allocs/op
BenchmarkGocraftWeb_GithubStatic 2000000 930 ns/op 296 B/op 5 allocs/op
BenchmarkGoji_GithubStatic 10000000 236 ns/op 0 B/op 0 allocs/op
BenchmarkGorillaMux_GithubStatic 100000 16391 ns/op 480 B/op 8 allocs/op
BenchmarkHttpRouter_GithubStatic 30000000 48.8 ns/op 0 B/op 0 allocs/op
BenchmarkMacaron_GithubStatic 1000000 2309 ns/op 752 B/op 8 allocs/op
BenchmarkMartini_GithubStatic 100000 14966 ns/op 784 B/op 10 allocs/op
BenchmarkBeego_GithubParam 1000000 2224 ns/op 784 B/op 11 allocs/op
BenchmarkChi_GithubParam 1000000 1269 ns/op 432 B/op 6 allocs/op
BenchmarkGocraftWeb_GithubParam 1000000 1735 ns/op 712 B/op 9 allocs/op
BenchmarkGoji_GithubParam 1000000 1099 ns/op 336 B/op 2 allocs/op
BenchmarkGorillaMux_GithubParam 200000 9847 ns/op 896 B/op 13 allocs/op
BenchmarkHttpRouter_GithubParam 5000000 287 ns/op 96 B/op 1 allocs/op
BenchmarkMacaron_GithubParam 500000 2484 ns/op 1040 B/op 9 allocs/op
BenchmarkMartini_GithubParam 100000 12141 ns/op 1136 B/op 11 allocs/op
BenchmarkBeego_GithubAll 3000 443974 ns/op 146272 B/op 2092 allocs/op
BenchmarkChi_GithubAll 5000 233097 ns/op 77328 B/op 1182 allocs/op
BenchmarkGocraftWeb_GithubAll 5000 335554 ns/op 131656 B/op 1686 allocs/op
BenchmarkGoji_GithubAll 3000 479323 ns/op 56113 B/op 334 allocs/op
BenchmarkGorillaMux_GithubAll 300 5759714 ns/op 167232 B/op 2469 allocs/op
BenchmarkHttpRouter_GithubAll 30000 52176 ns/op 13792 B/op 167 allocs/op
BenchmarkMacaron_GithubAll 3000 521045 ns/op 201140 B/op 1803 allocs/op
BenchmarkMartini_GithubAll 300 5186843 ns/op 228216 B/op 2483 allocs/op
BenchmarkBeego_GPlusStatic 1000000 1013 ns/op 352 B/op 7 allocs/op
BenchmarkChi_GPlusStatic 3000000 448 ns/op 144 B/op 5 allocs/op
BenchmarkGocraftWeb_GPlusStatic 2000000 685 ns/op 280 B/op 5 allocs/op
BenchmarkGoji_GPlusStatic 10000000 181 ns/op 0 B/op 0 allocs/op
BenchmarkGorillaMux_GPlusStatic 1000000 1530 ns/op 480 B/op 8 allocs/op
BenchmarkHttpRouter_GPlusStatic 50000000 28.8 ns/op 0 B/op 0 allocs/op
BenchmarkMacaron_GPlusStatic 1000000 1718 ns/op 752 B/op 8 allocs/op
BenchmarkMartini_GPlusStatic 500000 3154 ns/op 784 B/op 10 allocs/op
BenchmarkBeego_GPlusParam 1000000 1661 ns/op 720 B/op 10 allocs/op
BenchmarkChi_GPlusParam 2000000 846 ns/op 432 B/op 6 allocs/op
BenchmarkGocraftWeb_GPlusParam 1000000 1235 ns/op 648 B/op 8 allocs/op
BenchmarkGoji_GPlusParam 2000000 663 ns/op 336 B/op 2 allocs/op
BenchmarkGorillaMux_GPlusParam 500000 3384 ns/op 832 B/op 11 allocs/op
BenchmarkHttpRouter_GPlusParam 10000000 193 ns/op 64 B/op 1 allocs/op
BenchmarkMacaron_GPlusParam 1000000 2123 ns/op 1040 B/op 9 allocs/op
BenchmarkMartini_GPlusParam 500000 4113 ns/op 1104 B/op 11 allocs/op
BenchmarkBeego_GPlus2Params 1000000 2051 ns/op 784 B/op 11 allocs/op
BenchmarkChi_GPlus2Params 2000000 988 ns/op 432 B/op 6 allocs/op
BenchmarkGocraftWeb_GPlus2Params 1000000 1555 ns/op 712 B/op 9 allocs/op
BenchmarkGoji_GPlus2Params 2000000 972 ns/op 336 B/op 2 allocs/op
BenchmarkGorillaMux_GPlus2Params 200000 7477 ns/op 896 B/op 13 allocs/op
BenchmarkHttpRouter_GPlus2Params 10000000 217 ns/op 64 B/op 1 allocs/op
BenchmarkMacaron_GPlus2Params 1000000 2195 ns/op 1040 B/op 9 allocs/op
BenchmarkMartini_GPlus2Params 200000 10803 ns/op 1232 B/op 15 allocs/op
BenchmarkBeego_GPlusAll 100000 22973 ns/op 8976 B/op 129 allocs/op
BenchmarkChi_GPlusAll 200000 11113 ns/op 5040 B/op 76 allocs/op
BenchmarkGocraftWeb_GPlusAll 100000 16897 ns/op 8040 B/op 103 allocs/op
BenchmarkGoji_GPlusAll 200000 9634 ns/op 3696 B/op 22 allocs/op
BenchmarkGorillaMux_GPlusAll 30000 54598 ns/op 10432 B/op 147 allocs/op
BenchmarkHttpRouter_GPlusAll 1000000 2439 ns/op 640 B/op 11 allocs/op
BenchmarkMacaron_GPlusAll 50000 27721 ns/op 12944 B/op 115 allocs/op
BenchmarkMartini_GPlusAll 20000 73806 ns/op 14448 B/op 165 allocs/op
BenchmarkBeego_ParseStatic 1000000 1064 ns/op 368 B/op 7 allocs/op
BenchmarkChi_ParseStatic 3000000 451 ns/op 144 B/op 5 allocs/op
BenchmarkGocraftWeb_ParseStatic 2000000 742 ns/op 296 B/op 5 allocs/op
BenchmarkGoji_ParseStatic 10000000 221 ns/op 0 B/op 0 allocs/op
BenchmarkGorillaMux_ParseStatic 1000000 2408 ns/op 480 B/op 8 allocs/op
BenchmarkHttpRouter_ParseStatic 50000000 30.5 ns/op 0 B/op 0 allocs/op
BenchmarkMacaron_ParseStatic 1000000 1772 ns/op 752 B/op 8 allocs/op
BenchmarkMartini_ParseStatic 500000 3550 ns/op 784 B/op 10 allocs/op
BenchmarkBeego_ParseParam 1000000 1627 ns/op 736 B/op 10 allocs/op
BenchmarkChi_ParseParam 2000000 774 ns/op 432 B/op 6 allocs/op
BenchmarkGocraftWeb_ParseParam 1000000 1252 ns/op 664 B/op 8 allocs/op
BenchmarkGoji_ParseParam 2000000 732 ns/op 336 B/op 2 allocs/op
BenchmarkGorillaMux_ParseParam 500000 2813 ns/op 832 B/op 11 allocs/op
BenchmarkHttpRouter_ParseParam 10000000 172 ns/op 64 B/op 1 allocs/op
BenchmarkMacaron_ParseParam 500000 2108 ns/op 1040 B/op 9 allocs/op
BenchmarkMartini_ParseParam 300000 4156 ns/op 1104 B/op 11 allocs/op
BenchmarkBeego_Parse2Params 1000000 1888 ns/op 784 B/op 11 allocs/op
BenchmarkChi_Parse2Params 2000000 912 ns/op 432 B/op 6 allocs/op
BenchmarkGocraftWeb_Parse2Params 1000000 1460 ns/op 712 B/op 9 allocs/op
BenchmarkGoji_Parse2Params 2000000 733 ns/op 336 B/op 2 allocs/op
BenchmarkGorillaMux_Parse2Params 500000 3256 ns/op 896 B/op 13 allocs/op
BenchmarkHttpRouter_Parse2Params 10000000 190 ns/op 64 B/op 1 allocs/op
BenchmarkMacaron_Parse2Params 1000000 2146 ns/op 1040 B/op 9 allocs/op
BenchmarkMartini_Parse2Params 300000 3924 ns/op 1136 B/op 11 allocs/op
BenchmarkBeego_ParseAll 50000 39773 ns/op 15600 B/op 233 allocs/op
BenchmarkChi_ParseAll 100000 19122 ns/op 8352 B/op 146 allocs/op
BenchmarkGocraftWeb_ParseAll 50000 29921 ns/op 13728 B/op 181 allocs/op
BenchmarkGoji_ParseAll 100000 15311 ns/op 5376 B/op 32 allocs/op
BenchmarkGorillaMux_ParseAll 10000 104461 ns/op 18304 B/op 262 allocs/op
BenchmarkHttpRouter_ParseAll 500000 3473 ns/op 640 B/op 16 allocs/op
BenchmarkMacaron_ParseAll 30000 53780 ns/op 24160 B/op 224 allocs/op
BenchmarkMartini_ParseAll 10000 113890 ns/op 25600 B/op 276 allocs/op
BenchmarkBeego_StaticAll 10000 195204 ns/op 57744 B/op 1099 allocs/op
BenchmarkChi_StaticAll 20000 98652 ns/op 22608 B/op 785 allocs/op
BenchmarkGocraftWeb_StaticAll 10000 126416 ns/op 46440 B/op 785 allocs/op
BenchmarkGoji_StaticAll 30000 53369 ns/op 0 B/op 0 allocs/op
BenchmarkGorillaMux_StaticAll 1000 1566444 ns/op 75488 B/op 1264 allocs/op
BenchmarkHttpRouter_StaticAll 100000 13519 ns/op 0 B/op 0 allocs/op
BenchmarkMacaron_StaticAll 5000 300163 ns/op 118065 B/op 1256 allocs/op
BenchmarkMartini_StaticAll 500 2470568 ns/op 132819 B/op 2178 allocs/op
ok github.com/pkieltyka/go-http-routing-benchmark 239.137s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment