Skip to content
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

docs(benchmarks): for gin v1.5 #2153

Merged
merged 2 commits into from Nov 29, 2019
Merged

docs(benchmarks): for gin v1.5 #2153

merged 2 commits into from Nov 29, 2019

Conversation

appleboy
Copy link
Member

@appleboy appleboy commented Nov 26, 2019

as title. See the result: https://gist.github.com/appleboy/b5f2ecfaf50824ae9c64dcfb9165ae5e

Note: Gin v1.5 vs Echo v4.1.11

#GithubAPI Routes: 203
   Echo: 96120 Bytes
   Gin: 58512 Bytes

#GPlusAPI Routes: 13
   Echo: 9480 Bytes
   Gin: 4384 Bytes

#ParseAPI Routes: 26
   Echo: 11232 Bytes
   Gin: 7776 Bytes

#Static Routes: 157
   Echo: 76584 Bytes
   Gin: 34936 Bytes

goos: linux
goarch: amd64
pkg: github.com/julienschmidt/go-http-routing-benchmark
BenchmarkEcho_Param              9278648               120 ns/op               0 B/op          0 allocs/op
BenchmarkGin_Param               8428953               133 ns/op               0 B/op          0 allocs/op
BenchmarkEcho_Param5             4399473               275 ns/op               0 B/op          0 allocs/op
BenchmarkGin_Param5              4324972               268 ns/op               0 B/op          0 allocs/op
BenchmarkEcho_Param20            1397379               856 ns/op               0 B/op          0 allocs/op
BenchmarkGin_Param20             1538476               758 ns/op               0 B/op          0 allocs/op
BenchmarkEcho_ParamWrite         4614039               249 ns/op               8 B/op          1 allocs/op
BenchmarkGin_ParamWrite          4803710               242 ns/op               0 B/op          0 allocs/op
BenchmarkEcho_GithubStatic       7636855               158 ns/op               0 B/op          0 allocs/op
BenchmarkGin_GithubStatic        6228295               191 ns/op               0 B/op          0 allocs/op
BenchmarkEcho_GithubParam        3394911               351 ns/op               0 B/op          0 allocs/op
BenchmarkGin_GithubParam         2769294               431 ns/op               0 B/op          0 allocs/op
BenchmarkEcho_GithubAll            16564             71683 ns/op               0 B/op          0 allocs/op
BenchmarkGin_GithubAll             15772             75950 ns/op               0 B/op          0 allocs/op
BenchmarkEcho_GPlusStatic       11168800               108 ns/op               0 B/op          0 allocs/op
BenchmarkGin_GPlusStatic         9502640               126 ns/op               0 B/op          0 allocs/op
BenchmarkEcho_GPlusParam         7206974               166 ns/op               0 B/op          0 allocs/op
BenchmarkGin_GPlusParam          5560232               216 ns/op               0 B/op          0 allocs/op
BenchmarkEcho_GPlus2Params       4614630               263 ns/op               0 B/op          0 allocs/op
BenchmarkGin_GPlus2Params        3454112               347 ns/op               0 B/op          0 allocs/op
BenchmarkEcho_GPlusAll            395882              3081 ns/op               0 B/op          0 allocs/op
BenchmarkGin_GPlusAll             346232              3429 ns/op               0 B/op          0 allocs/op
BenchmarkEcho_ParseStatic       10582897               114 ns/op               0 B/op          0 allocs/op
BenchmarkGin_ParseStatic         8852340               135 ns/op               0 B/op          0 allocs/op
BenchmarkEcho_ParseParam         8430432               140 ns/op               0 B/op          0 allocs/op
BenchmarkGin_ParseParam          7924248               152 ns/op               0 B/op          0 allocs/op
BenchmarkEcho_Parse2Params       6224000               192 ns/op               0 B/op          0 allocs/op
BenchmarkGin_Parse2Params        5547054               216 ns/op               0 B/op          0 allocs/op
BenchmarkEcho_ParseAll            245606              4918 ns/op               0 B/op          0 allocs/op
BenchmarkGin_ParseAll             202203              5917 ns/op               0 B/op          0 allocs/op
BenchmarkEcho_StaticAll            27416             43551 ns/op               0 B/op          0 allocs/op
BenchmarkGin_StaticAll             25944             46077 ns/op               0 B/op          0 allocs/op
PASS
ok      github.com/julienschmidt/go-http-routing-benchmark      48.964s

I found the root cause on this PR: #1817 and issue #1644

Using master commit and remove the PR #1817

#GithubAPI Routes: 203
   Echo: 100088 Bytes
   Gin: 58512 Bytes

#GPlusAPI Routes: 13
   Echo: 9688 Bytes
   Gin: 4384 Bytes

#ParseAPI Routes: 26
   Echo: 11664 Bytes
   Gin: 7776 Bytes

#Static Routes: 157
   Echo: 80328 Bytes
   Gin: 34936 Bytes

goos: darwin
goarch: amd64
pkg: github.com/julienschmidt/go-http-routing-benchmark
BenchmarkEcho_Param        	13713124	        92.9 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_Param         	14935894	        77.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_Param5       	 5711541	       211 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_Param5        	 9060136	       133 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_Param20      	 2175253	       577 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_Param20       	 3861374	       309 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_ParamWrite   	 6411573	       206 ns/op	       8 B/op	       1 allocs/op
BenchmarkGin_ParamWrite    	 7676670	       148 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_GithubStatic 	10798402	       109 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_GithubStatic  	12585895	        95.1 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_GithubParam  	 5745453	       215 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_GithubParam   	 7828753	       154 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_GithubAll    	   29811	     41608 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_GithubAll     	   37480	     32039 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_GPlusStatic  	14638311	        83.1 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_GPlusStatic   	15855790	        74.9 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_GPlusParam   	 9653083	       125 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_GPlusParam    	12116191	       101 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_GPlus2Params 	 6289256	       189 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_GPlus2Params  	 9207663	       131 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_GPlusAll     	  656268	      1890 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_GPlusAll      	  950498	      1394 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_ParseStatic  	14030162	        86.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_ParseStatic   	13807999	        83.9 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_ParseParam   	11691818	       102 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_ParseParam    	13085680	        84.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_Parse2Params 	 8457060	       138 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_Parse2Params  	12408178	        99.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_ParseAll     	  409405	      3041 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_ParseAll      	  431499	      2619 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_StaticAll    	   43801	     26745 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_StaticAll     	   52173	     22331 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	github.com/julienschmidt/go-http-routing-benchmark	47.186s

Using master and merged this PR #1817:

#GithubAPI Routes: 203
   Echo: 100088 Bytes
   Gin: 58512 Bytes

#GPlusAPI Routes: 13
   Echo: 9688 Bytes
   Gin: 4384 Bytes

#ParseAPI Routes: 26
   Echo: 11872 Bytes
   Gin: 7776 Bytes

#Static Routes: 157
   Echo: 80328 Bytes
   Gin: 34936 Bytes

goos: darwin
goarch: amd64
pkg: github.com/julienschmidt/go-http-routing-benchmark
BenchmarkEcho_Param        	13868967	        91.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_Param         	11227989	       112 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_Param5       	 5590839	       217 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_Param5        	 5693301	       208 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_Param20      	 1972708	       576 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_Param20       	 2329970	       500 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_ParamWrite   	 6480324	       199 ns/op	       8 B/op	       1 allocs/op
BenchmarkGin_ParamWrite    	 6192961	       183 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_GithubStatic 	11066961	       110 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_GithubStatic  	 9331580	       131 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_GithubParam  	 5655951	       209 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_GithubParam   	 4631484	       264 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_GithubAll    	   28891	     40733 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_GithubAll     	   23617	     49969 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_GPlusStatic  	14360215	        82.9 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_GPlusStatic   	14073127	        90.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_GPlusParam   	 9618414	       125 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_GPlusParam    	 6743815	       177 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_GPlus2Params 	 6142123	       192 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_GPlus2Params  	 4751052	       261 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_GPlusAll     	  588553	      1935 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_GPlusAll      	  532138	      2351 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_ParseStatic  	14569162	        82.5 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_ParseStatic   	11442459	       103 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_ParseParam   	10626462	       103 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_ParseParam    	 9372045	       128 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_Parse2Params 	 7996203	       144 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_Parse2Params  	 6957308	       175 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_ParseAll     	  383593	      3289 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_ParseAll      	  296257	      4158 ns/op	       0 B/op	       0 allocs/op
BenchmarkEcho_StaticAll    	   42117	     28272 ns/op	       0 B/op	       0 allocs/op
BenchmarkGin_StaticAll     	   38401	     31488 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	github.com/julienschmidt/go-http-routing-benchmark	46.256s

cc @dmarkham @thinkerou

@codecov
Copy link

codecov bot commented Nov 26, 2019

Codecov Report

Merging #2153 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2153   +/-   ##
=======================================
  Coverage   98.61%   98.61%           
=======================================
  Files          40       40           
  Lines        2240     2240           
=======================================
  Hits         2209     2209           
  Misses         16       16           
  Partials       15       15

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d5f12ac...d0be58b. Read the comment docs.

@thinkerou
Copy link
Member

@appleboy #2159 merged, the pr also changed again?

@appleboy
Copy link
Member Author

@thinkerou No. This is the benchmark for gin 1.5 version, not the latest version (master branch). I will add the gin version in documentation.

@thinkerou
Copy link
Member

@appleboy got it, thanks!

@thinkerou thinkerou merged commit 3957f6b into master Nov 29, 2019
@appleboy appleboy deleted the appleboy-patch-1 branch December 1, 2019 05:17
ThomasObenaus pushed a commit to ThomasObenaus/gin that referenced this pull request Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants