Skip to content

Instantly share code, notes, and snippets.

@xthezealot
Last active September 11, 2023 15:17
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 xthezealot/bb632f6b104deb2a50ce476c25f7bec2 to your computer and use it in GitHub Desktop.
Save xthezealot/bb632f6b104deb2a50ce476c25f7bec2 to your computer and use it in GitHub Desktop.
Bench gowww/router vs. julienschmidt/httprouter
#GithubAPI Routes: 203
GowwwRouter: 88024 Bytes
HttpRouter: 37464 Bytes
#GPlusAPI Routes: 13
GowwwRouter: 6272 Bytes
HttpRouter: 2712 Bytes
#ParseAPI Routes: 26
GowwwRouter: 10112 Bytes
HttpRouter: 4976 Bytes
#Static Routes: 157
GowwwRouter: 24968 Bytes
HttpRouter: 21744 Bytes
BenchmarkGowwwRouter_Param 5000000 336 ns/op 312 B/op 3 allocs/op
BenchmarkHttpRouter_Param 20000000 84.5 ns/op 32 B/op 1 allocs/op
BenchmarkGowwwRouter_Param5 3000000 402 ns/op 312 B/op 3 allocs/op
BenchmarkHttpRouter_Param5 10000000 225 ns/op 160 B/op 1 allocs/op
BenchmarkGowwwRouter_Param20 2000000 693 ns/op 312 B/op 3 allocs/op
BenchmarkHttpRouter_Param20 2000000 663 ns/op 640 B/op 1 allocs/op
BenchmarkGowwwRouter_ParamWrite 1000000 1451 ns/op 1024 B/op 11 allocs/op
BenchmarkHttpRouter_ParamWrite 10000000 133 ns/op 32 B/op 1 allocs/op
BenchmarkGowwwRouter_GithubStatic 20000000 79.9 ns/op 0 B/op 0 allocs/op
BenchmarkHttpRouter_GithubStatic 30000000 46.5 ns/op 0 B/op 0 allocs/op
BenchmarkGowwwRouter_GithubParam 3000000 456 ns/op 312 B/op 3 allocs/op
BenchmarkHttpRouter_GithubParam 10000000 228 ns/op 96 B/op 1 allocs/op
BenchmarkGowwwRouter_GithubAll 20000 84537 ns/op 52104 B/op 501 allocs/op
BenchmarkHttpRouter_GithubAll 50000 37435 ns/op 13792 B/op 167 allocs/op
BenchmarkGowwwRouter_GPlusStatic 50000000 32.8 ns/op 0 B/op 0 allocs/op
BenchmarkHttpRouter_GPlusStatic 50000000 27.6 ns/op 0 B/op 0 allocs/op
BenchmarkGowwwRouter_GPlusParam 5000000 346 ns/op 312 B/op 3 allocs/op
BenchmarkHttpRouter_GPlusParam 10000000 144 ns/op 64 B/op 1 allocs/op
BenchmarkGowwwRouter_GPlus2Params 5000000 384 ns/op 312 B/op 3 allocs/op
BenchmarkHttpRouter_GPlus2Params 10000000 172 ns/op 64 B/op 1 allocs/op
BenchmarkGowwwRouter_GPlusAll 300000 4437 ns/op 3432 B/op 33 allocs/op
BenchmarkHttpRouter_GPlusAll 1000000 1795 ns/op 640 B/op 11 allocs/op
BenchmarkGowwwRouter_ParseStatic 50000000 34.6 ns/op 0 B/op 0 allocs/op
BenchmarkHttpRouter_ParseStatic 50000000 29.4 ns/op 0 B/op 0 allocs/op
BenchmarkGowwwRouter_ParseParam 5000000 339 ns/op 312 B/op 3 allocs/op
BenchmarkHttpRouter_ParseParam 10000000 125 ns/op 64 B/op 1 allocs/op
BenchmarkGowwwRouter_Parse2Params 5000000 363 ns/op 312 B/op 3 allocs/op
BenchmarkHttpRouter_Parse2Params 10000000 145 ns/op 64 B/op 1 allocs/op
BenchmarkGowwwRouter_ParseAll 200000 6772 ns/op 4992 B/op 48 allocs/op
BenchmarkHttpRouter_ParseAll 500000 2481 ns/op 640 B/op 16 allocs/op
BenchmarkGowwwRouter_StaticAll 100000 17814 ns/op 0 B/op 0 allocs/op
BenchmarkHttpRouter_StaticAll 200000 11809 ns/op 0 B/op 0 allocs/op
###################################
ProcessingTime 0ms
Concurrency 5000
###################################
testing web framework: gowww
throughput: 55006.26 requests/second
finsihed testing gowww
testing web framework: httprouter
throughput: 21124.75 requests/second
finsihed testing httprouter
###################################
ProcessingTime 10ms
Concurrency 5000
###################################
testing web framework: gowww
TotalAlloc: 1327
Alloc: 38
HeapAlloc: 38
HeapSys: 56
throughput: 34430.26 requests/second
finsihed testing gowww
testing web framework: httprouter
TotalAlloc: 1194
Alloc: 23
HeapAlloc: 23
HeapSys: 37
throughput: 45285.88 requests/second
./test.sh: line 18: 15730 Killed: 9 ./$server_bin_name $2 $3
finsihed testing httprouter
###################################
ProcessingTime 100ms
Concurrency 5000
###################################
testing web framework: gowww
TotalAlloc: 278
Alloc: 46
HeapAlloc: 46
HeapSys: 52
throughput: 14608.17 requests/second
./test.sh: line 18: 15763 Killed: 9 ./$server_bin_name $2 $3
finsihed testing gowww
testing web framework: httprouter
TotalAlloc: 454
Alloc: 41
HeapAlloc: 41
HeapSys: 68
throughput: 12857.94 requests/second
finsihed testing httprouter
###################################
ProcessingTime 500ms
Concurrency 5000
###################################
testing web framework: gowww
TotalAlloc: 2
Alloc: 2
HeapAlloc: 2
HeapSys: 3
throughput: 2474.82 requests/second
finsihed testing gowww
testing web framework: httprouter
TotalAlloc: 111
Alloc: 40
HeapAlloc: 40
HeapSys: 50
throughput: 2199.66 requests/second
finsihed testing httprouter
###################################
ProcessingTime 30ms
Concurrency 100
###################################
testing web framework: gowww
TotalAlloc: 87
Alloc: 4
HeapAlloc: 4
HeapSys: 6
throughput: 2932.93 requests/second
./test.sh: line 18: 15892 Killed: 9 ./$server_bin_name $2 $3
finsihed testing gowww
testing web framework: httprouter
TotalAlloc: 87
Alloc: 3
HeapAlloc: 3
HeapSys: 7
throughput: 2931.16 requests/second
./test.sh: line 18: 15931 Killed: 9 ./$server_bin_name $2 $3
finsihed testing httprouter
###################################
ProcessingTime 30ms
Concurrency 1000
###################################
testing web framework: gowww
TotalAlloc: 823
Alloc: 20
HeapAlloc: 20
HeapSys: 30
throughput: 28783.79 requests/second
./test.sh: line 18: 16007 Killed: 9 ./$server_bin_name $2 $3
finsihed testing gowww
testing web framework: httprouter
TotalAlloc: 813
Alloc: 22
HeapAlloc: 22
HeapSys: 30
throughput: 28624.93 requests/second
./test.sh: line 18: 16025 Killed: 9 ./$server_bin_name $2 $3
finsihed testing httprouter
BenchmarkParamsGowwwRouter-8 2000000 927 ns/op 1248 B/op 12 allocs/op
BenchmarkParamsHTTPRouter-8 1000000 1304 ns/op 235 B/op 8 allocs/op
BenchmarkStaticGowwwRouter-8 3000000 536 ns/op 0 B/op 0 allocs/op
BenchmarkStaticHTTPRouter-8 1000000 1342 ns/op 107 B/op 4 allocs/op
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment