frisbee-go icon indicating copy to clipboard operation
frisbee-go copied to clipboard

Improve slightly the performance by arranging/simplifying the code

Open nicolaenicora opened this issue 2 years ago • 0 comments

Description

Improved slightly the performance according to my observation. Rearranged the the code making it easy to follow.

Benchmarking

Frisbee tries to adhere to strict performance requirements, so please make sure to run go test -bench=. ./... and paste the results below:

Benchmarking Results:

With pull request changes

goos: darwin
goarch: amd64
pkg: github.com/loopholelabs/frisbee-go
cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
BenchmarkAsyncThroughputPipe
BenchmarkAsyncThroughputPipe/32_Bytes
BenchmarkAsyncThroughputPipe/32_Bytes-16             	   15772	     76704 ns/op	  41.72 MB/s	   10782 B/op	     221 allocs/op
BenchmarkAsyncThroughputPipe/512_Bytes
BenchmarkAsyncThroughputPipe/512_Bytes-16            	   14968	     84578 ns/op	 605.36 MB/s	   10716 B/op	     220 allocs/op
BenchmarkAsyncThroughputPipe/1024_Bytes
BenchmarkAsyncThroughputPipe/1024_Bytes-16           	   12868	     92019 ns/op	1112.82 MB/s	   10738 B/op	     220 allocs/op
BenchmarkAsyncThroughputPipe/2048_Bytes
BenchmarkAsyncThroughputPipe/2048_Bytes-16           	   10000	    109973 ns/op	1862.28 MB/s	   10800 B/op	     221 allocs/op
BenchmarkAsyncThroughputPipe/4096_Bytes
BenchmarkAsyncThroughputPipe/4096_Bytes-16           	    7682	    138536 ns/op	2956.63 MB/s	   11081 B/op	     227 allocs/op
BenchmarkAsyncThroughputNetwork
BenchmarkAsyncThroughputNetwork/32_Bytes
BenchmarkAsyncThroughputNetwork/32_Bytes-16          	   16473	     72081 ns/op	  44.39 MB/s	     262 B/op	       4 allocs/op
BenchmarkAsyncThroughputNetwork/512_Bytes
BenchmarkAsyncThroughputNetwork/512_Bytes-16         	   14217	     86770 ns/op	 590.07 MB/s	     262 B/op	       4 allocs/op
BenchmarkAsyncThroughputNetwork/1024_Bytes
BenchmarkAsyncThroughputNetwork/1024_Bytes-16        	   12481	     97194 ns/op	1053.56 MB/s	     262 B/op	       4 allocs/op
BenchmarkAsyncThroughputNetwork/2048_Bytes
BenchmarkAsyncThroughputNetwork/2048_Bytes-16        	    9331	    112645 ns/op	1818.10 MB/s	     268 B/op	       4 allocs/op
BenchmarkAsyncThroughputNetwork/4096_Bytes
BenchmarkAsyncThroughputNetwork/4096_Bytes-16        	    7326	    160037 ns/op	2559.41 MB/s	     274 B/op	       4 allocs/op
BenchmarkAsyncThroughputNetworkMultiple
BenchmarkAsyncThroughputNetworkMultiple/1_Pair,_32_Bytes
BenchmarkAsyncThroughputNetworkMultiple/1_Pair,_32_Bytes-16         	   16558	     73460 ns/op	  43.56 MB/s	     407 B/op	       4 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/2_Pair,_32_Bytes
BenchmarkAsyncThroughputNetworkMultiple/2_Pair,_32_Bytes-16         	   15800	     72799 ns/op	  43.96 MB/s	     840 B/op	       8 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/5_Pair,_32_Bytes
BenchmarkAsyncThroughputNetworkMultiple/5_Pair,_32_Bytes-16         	    7434	    158007 ns/op	  20.25 MB/s	    2960 B/op	      20 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/10_Pair,_32_Bytes
BenchmarkAsyncThroughputNetworkMultiple/10_Pair,_32_Bytes-16        	    5841	    196916 ns/op	  16.25 MB/s	    6710 B/op	      40 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/Half_CPU_Pair,_32_Bytes
BenchmarkAsyncThroughputNetworkMultiple/Half_CPU_Pair,_32_Bytes-16  	    5948	    198727 ns/op	  16.10 MB/s	    5342 B/op	      32 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/CPU_Pair,_32_Bytes
BenchmarkAsyncThroughputNetworkMultiple/CPU_Pair,_32_Bytes-16       	    8115	    153625 ns/op	  20.83 MB/s	    8888 B/op	      64 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/Double_CPU_Pair,_32_Bytes
BenchmarkAsyncThroughputNetworkMultiple/Double_CPU_Pair,_32_Bytes-16         	    4728	    263903 ns/op	  12.13 MB/s	   24743 B/op	     130 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/1_Pair,_512_Bytes
BenchmarkAsyncThroughputNetworkMultiple/1_Pair,_512_Bytes-16                 	   12248	     87315 ns/op	 586.39 MB/s	     456 B/op	       4 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/2_Pair,_512_Bytes
BenchmarkAsyncThroughputNetworkMultiple/2_Pair,_512_Bytes-16                 	   13274	     88248 ns/op	 580.18 MB/s	     901 B/op	       8 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/5_Pair,_512_Bytes
BenchmarkAsyncThroughputNetworkMultiple/5_Pair,_512_Bytes-16                 	    6885	    166370 ns/op	 307.75 MB/s	    3095 B/op	      20 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/10_Pair,_512_Bytes
BenchmarkAsyncThroughputNetworkMultiple/10_Pair,_512_Bytes-16                	    4807	    250751 ns/op	 204.19 MB/s	    7619 B/op	      40 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/Half_CPU_Pair,_512_Bytes
BenchmarkAsyncThroughputNetworkMultiple/Half_CPU_Pair,_512_Bytes-16          	    4339	    239009 ns/op	 214.22 MB/s	    6544 B/op	      32 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/CPU_Pair,_512_Bytes
BenchmarkAsyncThroughputNetworkMultiple/CPU_Pair,_512_Bytes-16               	    4604	    231017 ns/op	 221.63 MB/s	   12549 B/op	      65 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/Double_CPU_Pair,_512_Bytes
BenchmarkAsyncThroughputNetworkMultiple/Double_CPU_Pair,_512_Bytes-16        	    2630	    440853 ns/op	 116.14 MB/s	   37539 B/op	     132 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/1_Pair,_4096_Bytes
BenchmarkAsyncThroughputNetworkMultiple/1_Pair,_4096_Bytes-16                	    6576	    172904 ns/op	2368.94 MB/s	     646 B/op	       4 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/2_Pair,_4096_Bytes
BenchmarkAsyncThroughputNetworkMultiple/2_Pair,_4096_Bytes-16                	    5642	    214470 ns/op	1909.83 MB/s	    1570 B/op	       8 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/5_Pair,_4096_Bytes
BenchmarkAsyncThroughputNetworkMultiple/5_Pair,_4096_Bytes-16                	    2354	    486917 ns/op	 841.21 MB/s	    6909 B/op	      20 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/10_Pair,_4096_Bytes
BenchmarkAsyncThroughputNetworkMultiple/10_Pair,_4096_Bytes-16               	    1428	    802679 ns/op	 510.29 MB/s	   20885 B/op	      42 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/Half_CPU_Pair,_4096_Bytes
BenchmarkAsyncThroughputNetworkMultiple/Half_CPU_Pair,_4096_Bytes-16         	    1615	    713758 ns/op	 573.86 MB/s	   15069 B/op	      34 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/CPU_Pair,_4096_Bytes
BenchmarkAsyncThroughputNetworkMultiple/CPU_Pair,_4096_Bytes-16              	     889	   1316666 ns/op	 311.09 MB/s	   50167 B/op	      69 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/Double_CPU_Pair,_4096_Bytes
BenchmarkAsyncThroughputNetworkMultiple/Double_CPU_Pair,_4096_Bytes-16       	     422	   2810712 ns/op	 145.73 MB/s	  194943 B/op	     144 allocs/op
BenchmarkThroughputClient
BenchmarkThroughputClient/test
BenchmarkThroughputClient/test-16                                            	      30	  37884476 ns/op	 885.69 MB/s	    2964 B/op	       6 allocs/op
BenchmarkThroughputResponseClient
BenchmarkThroughputResponseClient/test
BenchmarkThroughputResponseClient/test-16                                    	      31	  36678833 ns/op	 914.80 MB/s	    3777 B/op	      12 allocs/op
BenchmarkThroughputServerSingle
BenchmarkThroughputServerSingle/test
BenchmarkThroughputServerSingle/test-16                                      	      32	  36383698 ns/op	 922.22 MB/s	    2670 B/op	       5 allocs/op
BenchmarkThroughputServerUnlimited
BenchmarkThroughputServerUnlimited/test
BenchmarkThroughputServerUnlimited/test-16                                   	      26	  42803260 ns/op	 783.91 MB/s	 7470747 B/op	  131277 allocs/op
BenchmarkThroughputServerLimited
BenchmarkThroughputServerLimited/test
BenchmarkThroughputServerLimited/test-16                                     	      26	 191575936 ns/op	 175.15 MB/s	 8225015 B/op	  136386 allocs/op
BenchmarkThroughputResponseServerSingle
BenchmarkThroughputResponseServerSingle/test
BenchmarkThroughputResponseServerSingle/test-16                              	      33	  34782875 ns/op	 964.67 MB/s	    2598 B/op	       3 allocs/op
BenchmarkThroughputResponseServerSlowSingle
BenchmarkThroughputResponseServerSlowSingle/test
BenchmarkThroughputResponseServerSlowSingle/test-16                          	       1	4982463979 ns/op	   6.73 MB/s	37929616 B/op	  259747 allocs/op
BenchmarkThroughputResponseServerSlowUnlimited
BenchmarkThroughputResponseServerSlowUnlimited/test
BenchmarkThroughputResponseServerSlowUnlimited/test-16                       	      30	  43102973 ns/op	 778.46 MB/s	 7018450 B/op	  131601 allocs/op
BenchmarkThroughputResponseServerSlowLimited
BenchmarkThroughputResponseServerSlowLimited/test
BenchmarkThroughputResponseServerSlowLimited/test-16                         	      12	  99086456 ns/op	 338.63 MB/s	 7578102 B/op	  133824 allocs/op
BenchmarkSyncThroughputPipe
BenchmarkSyncThroughputPipe/32_Bytes
BenchmarkSyncThroughputPipe/32_Bytes-16                                      	    4224	    286418 ns/op	  11.17 MB/s	   10659 B/op	     304 allocs/op
BenchmarkSyncThroughputPipe/512_Bytes
BenchmarkSyncThroughputPipe/512_Bytes-16                                     	    4285	    283816 ns/op	 180.40 MB/s	   10658 B/op	     304 allocs/op
BenchmarkSyncThroughputPipe/1024_Bytes
BenchmarkSyncThroughputPipe/1024_Bytes-16                                    	    4112	    284195 ns/op	 360.32 MB/s	   10657 B/op	     304 allocs/op
BenchmarkSyncThroughputPipe/2048_Bytes
BenchmarkSyncThroughputPipe/2048_Bytes-16                                    	    4156	    289235 ns/op	 708.08 MB/s	   10667 B/op	     304 allocs/op
BenchmarkSyncThroughputPipe/4096_Bytes
BenchmarkSyncThroughputPipe/4096_Bytes-16                                    	    4098	    297116 ns/op	1378.59 MB/s	   10656 B/op	     304 allocs/op
BenchmarkSyncThroughputNetwork
BenchmarkSyncThroughputNetwork/32_Bytes
BenchmarkSyncThroughputNetwork/32_Bytes-16                                   	    1430	    765802 ns/op	   4.18 MB/s	    1058 B/op	     104 allocs/op
BenchmarkSyncThroughputNetwork/512_Bytes
BenchmarkSyncThroughputNetwork/512_Bytes-16                                  	    1449	    790812 ns/op	  64.74 MB/s	    1058 B/op	     104 allocs/op
BenchmarkSyncThroughputNetwork/1024_Bytes
BenchmarkSyncThroughputNetwork/1024_Bytes-16                                 	    1490	    787202 ns/op	 130.08 MB/s	    1059 B/op	     104 allocs/op
BenchmarkSyncThroughputNetwork/2048_Bytes
BenchmarkSyncThroughputNetwork/2048_Bytes-16                                 	    1498	    796446 ns/op	 257.14 MB/s	    1064 B/op	     104 allocs/op
BenchmarkSyncThroughputNetwork/4096_Bytes
BenchmarkSyncThroughputNetwork/4096_Bytes-16                                 	    1474	    803799 ns/op	 509.58 MB/s	    1082 B/op	     104 allocs/op
BenchmarkAsyncThroughputLarge
BenchmarkAsyncThroughputLarge/1MB
BenchmarkAsyncThroughputLarge/1MB-16                                         	      66	  16391257 ns/op	6397.17 MB/s	   69418 B/op	       4 allocs/op
BenchmarkAsyncThroughputLarge/2MB
BenchmarkAsyncThroughputLarge/2MB-16                                         	      32	  33407475 ns/op	6277.49 MB/s	  289823 B/op	       5 allocs/op
BenchmarkAsyncThroughputLarge/4MB
BenchmarkAsyncThroughputLarge/4MB-16                                         	      16	  69671561 ns/op	6020.11 MB/s	  266869 B/op	       5 allocs/op
BenchmarkAsyncThroughputLarge/8MB
BenchmarkAsyncThroughputLarge/8MB-16                                         	       7	 149223390 ns/op	5621.51 MB/s	    1254 B/op	       7 allocs/op
BenchmarkAsyncThroughputLarge/16MB
BenchmarkAsyncThroughputLarge/16MB-16                                        	       3	 377709154 ns/op	4441.83 MB/s	25213029 B/op	      19 allocs/op
BenchmarkSyncThroughputLarge
BenchmarkSyncThroughputLarge/1MB
BenchmarkSyncThroughputLarge/1MB-16                                          	      80	  14253335 ns/op	7356.71 MB/s	    1097 B/op	     104 allocs/op
BenchmarkSyncThroughputLarge/2MB
BenchmarkSyncThroughputLarge/2MB-16                                          	      38	  27622528 ns/op	7592.18 MB/s	  558539 B/op	     106 allocs/op
BenchmarkSyncThroughputLarge/4MB
BenchmarkSyncThroughputLarge/4MB-16                                          	      18	  62998418 ns/op	6657.79 MB/s	 2346696 B/op	     109 allocs/op
BenchmarkSyncThroughputLarge/8MB
BenchmarkSyncThroughputLarge/8MB-16                                          	       7	 146075167 ns/op	5742.67 MB/s	23833341 B/op	     129 allocs/op
BenchmarkSyncThroughputLarge/16MB
BenchmarkSyncThroughputLarge/16MB-16                                         	       4	 281941662 ns/op	5950.60 MB/s	    1708 B/op	     106 allocs/op
BenchmarkTCPThroughput
BenchmarkTCPThroughput/32_Bytes
BenchmarkTCPThroughput/32_Bytes-16                                           	   18444	     64106 ns/op	  49.92 MB/s	     304 B/op	       4 allocs/op
BenchmarkTCPThroughput/512_Bytes
BenchmarkTCPThroughput/512_Bytes-16                                          	   13072	     90584 ns/op	 565.22 MB/s	     304 B/op	       4 allocs/op
BenchmarkTCPThroughput/1024_Bytes
BenchmarkTCPThroughput/1024_Bytes-16                                         	    7658	    140613 ns/op	 728.24 MB/s	     304 B/op	       4 allocs/op
BenchmarkTCPThroughput/2048_Bytes
BenchmarkTCPThroughput/2048_Bytes-16                                         	    4599	    252664 ns/op	 810.56 MB/s	     304 B/op	       4 allocs/op
BenchmarkTCPThroughput/4096_Bytes
BenchmarkTCPThroughput/4096_Bytes-16                                         	    2624	    457387 ns/op	 895.52 MB/s	     304 B/op	       4 allocs/op
BenchmarkTCPThroughput/1MB
BenchmarkTCPThroughput/1MB-16                                                	      85	  13631997 ns/op	7692.02 MB/s	     304 B/op	       4 allocs/op
BenchmarkTCPThroughput/2MB
BenchmarkTCPThroughput/2MB-16                                                	      43	  26084987 ns/op	8039.69 MB/s	     304 B/op	       4 allocs/op
BenchmarkTCPThroughput/4MB
BenchmarkTCPThroughput/4MB-16                                                	      21	  59577175 ns/op	7040.12 MB/s	     304 B/op	       4 allocs/op
BenchmarkTCPThroughput/8MB
BenchmarkTCPThroughput/8MB-16                                                	       8	 138025741 ns/op	6077.57 MB/s	     304 B/op	       4 allocs/op
BenchmarkTCPThroughput/16MB
BenchmarkTCPThroughput/16MB-16                                               	       4	 280981309 ns/op	5970.94 MB/s	     304 B/op	       4 allocs/op
PASS
ok  	github.com/loopholelabs/frisbee-go	122.079s
?   	github.com/loopholelabs/frisbee-go/internal/dialer	[no test files]
goos: darwin
goarch: amd64
pkg: github.com/loopholelabs/frisbee-go/pkg/metadata
cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
BenchmarkEncode
BenchmarkEncode-16          	68740123	        17.08 ns/op	       8 B/op	       1 allocs/op
BenchmarkDecode
BenchmarkDecode-16          	228144124	         5.118 ns/op	       0 B/op	       0 allocs/op
BenchmarkEncodeDecode
BenchmarkEncodeDecode-16    	49805935	        24.33 ns/op	       8 B/op	       1 allocs/op
PASS
ok  	github.com/loopholelabs/frisbee-go/pkg/metadata	5.470s
PASS
ok  	github.com/loopholelabs/frisbee-go/pkg/packet	0.676s

From original source

goos: darwin
goarch: amd64
pkg: github.com/loopholelabs/frisbee-go
cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
BenchmarkAsyncThroughputPipe
BenchmarkAsyncThroughputPipe/32_Bytes
BenchmarkAsyncThroughputPipe/32_Bytes-16             	   17452	     66950 ns/op	  47.80 MB/s	   10259 B/op	     210 allocs/op
BenchmarkAsyncThroughputPipe/512_Bytes
BenchmarkAsyncThroughputPipe/512_Bytes-16            	   15924	     74240 ns/op	 689.65 MB/s	   10256 B/op	     210 allocs/op
BenchmarkAsyncThroughputPipe/1024_Bytes
BenchmarkAsyncThroughputPipe/1024_Bytes-16           	   15302	     81556 ns/op	1255.57 MB/s	   10356 B/op	     211 allocs/op
BenchmarkAsyncThroughputPipe/2048_Bytes
BenchmarkAsyncThroughputPipe/2048_Bytes-16           	   12382	     95161 ns/op	2152.14 MB/s	   10494 B/op	     215 allocs/op
BenchmarkAsyncThroughputPipe/4096_Bytes
BenchmarkAsyncThroughputPipe/4096_Bytes-16           	    9098	    129042 ns/op	3174.15 MB/s	   10821 B/op	     222 allocs/op
BenchmarkAsyncThroughputNetwork
BenchmarkAsyncThroughputNetwork/32_Bytes
BenchmarkAsyncThroughputNetwork/32_Bytes-16          	   17136	     70024 ns/op	  45.70 MB/s	     260 B/op	       4 allocs/op
BenchmarkAsyncThroughputNetwork/512_Bytes
BenchmarkAsyncThroughputNetwork/512_Bytes-16         	   14071	     84829 ns/op	 603.57 MB/s	     262 B/op	       4 allocs/op
BenchmarkAsyncThroughputNetwork/1024_Bytes
BenchmarkAsyncThroughputNetwork/1024_Bytes-16        	   13459	     90023 ns/op	1137.49 MB/s	     262 B/op	       4 allocs/op
BenchmarkAsyncThroughputNetwork/2048_Bytes
BenchmarkAsyncThroughputNetwork/2048_Bytes-16        	   10000	    107527 ns/op	1904.64 MB/s	     268 B/op	       4 allocs/op
BenchmarkAsyncThroughputNetwork/4096_Bytes
BenchmarkAsyncThroughputNetwork/4096_Bytes-16        	    8097	    147402 ns/op	2778.80 MB/s	     295 B/op	       4 allocs/op
BenchmarkAsyncThroughputNetworkMultiple
BenchmarkAsyncThroughputNetworkMultiple/1_Pair,_32_Bytes
BenchmarkAsyncThroughputNetworkMultiple/1_Pair,_32_Bytes-16         	   17271	     69104 ns/op	  46.31 MB/s	     400 B/op	       4 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/2_Pair,_32_Bytes
BenchmarkAsyncThroughputNetworkMultiple/2_Pair,_32_Bytes-16         	   16376	     78842 ns/op	  40.59 MB/s	     827 B/op	       8 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/5_Pair,_32_Bytes
BenchmarkAsyncThroughputNetworkMultiple/5_Pair,_32_Bytes-16         	    7230	    141858 ns/op	  22.56 MB/s	    3015 B/op	      20 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/10_Pair,_32_Bytes
BenchmarkAsyncThroughputNetworkMultiple/10_Pair,_32_Bytes-16        	    5612	    189627 ns/op	  16.88 MB/s	    6913 B/op	      40 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/Half_CPU_Pair,_32_Bytes
BenchmarkAsyncThroughputNetworkMultiple/Half_CPU_Pair,_32_Bytes-16  	    6045	    195183 ns/op	  16.39 MB/s	    5292 B/op	      32 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/CPU_Pair,_32_Bytes
BenchmarkAsyncThroughputNetworkMultiple/CPU_Pair,_32_Bytes-16       	    8004	    150381 ns/op	  21.28 MB/s	    8958 B/op	      64 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/Double_CPU_Pair,_32_Bytes
BenchmarkAsyncThroughputNetworkMultiple/Double_CPU_Pair,_32_Bytes-16         	    4779	    253776 ns/op	  12.61 MB/s	   24387 B/op	     130 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/1_Pair,_512_Bytes
BenchmarkAsyncThroughputNetworkMultiple/1_Pair,_512_Bytes-16                 	   13399	     86186 ns/op	 594.06 MB/s	     441 B/op	       4 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/2_Pair,_512_Bytes
BenchmarkAsyncThroughputNetworkMultiple/2_Pair,_512_Bytes-16                 	   13623	     87801 ns/op	 583.14 MB/s	     887 B/op	       8 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/5_Pair,_512_Bytes
BenchmarkAsyncThroughputNetworkMultiple/5_Pair,_512_Bytes-16                 	    7036	    144610 ns/op	 354.06 MB/s	    3066 B/op	      20 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/10_Pair,_512_Bytes
BenchmarkAsyncThroughputNetworkMultiple/10_Pair,_512_Bytes-16                	    4341	    243143 ns/op	 210.58 MB/s	    8204 B/op	      41 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/Half_CPU_Pair,_512_Bytes
BenchmarkAsyncThroughputNetworkMultiple/Half_CPU_Pair,_512_Bytes-16          	    5563	    192103 ns/op	 266.52 MB/s	    5580 B/op	      32 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/CPU_Pair,_512_Bytes
BenchmarkAsyncThroughputNetworkMultiple/CPU_Pair,_512_Bytes-16               	    6310	    206531 ns/op	 247.90 MB/s	   10231 B/op	      64 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/Double_CPU_Pair,_512_Bytes
BenchmarkAsyncThroughputNetworkMultiple/Double_CPU_Pair,_512_Bytes-16        	    3138	    405504 ns/op	 126.26 MB/s	   32991 B/op	     131 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/1_Pair,_4096_Bytes
BenchmarkAsyncThroughputNetworkMultiple/1_Pair,_4096_Bytes-16                	    6518	    170606 ns/op	2400.86 MB/s	     681 B/op	       4 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/2_Pair,_4096_Bytes
BenchmarkAsyncThroughputNetworkMultiple/2_Pair,_4096_Bytes-16                	    5454	    211727 ns/op	1934.57 MB/s	    1506 B/op	       8 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/5_Pair,_4096_Bytes
BenchmarkAsyncThroughputNetworkMultiple/5_Pair,_4096_Bytes-16                	    2522	    440344 ns/op	 930.18 MB/s	    6530 B/op	      20 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/10_Pair,_4096_Bytes
BenchmarkAsyncThroughputNetworkMultiple/10_Pair,_4096_Bytes-16               	    1467	    766273 ns/op	 534.54 MB/s	   20372 B/op	      42 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/Half_CPU_Pair,_4096_Bytes
BenchmarkAsyncThroughputNetworkMultiple/Half_CPU_Pair,_4096_Bytes-16         	    1767	    635166 ns/op	 644.87 MB/s	   13945 B/op	      33 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/CPU_Pair,_4096_Bytes
BenchmarkAsyncThroughputNetworkMultiple/CPU_Pair,_4096_Bytes-16              	     902	   1293243 ns/op	 316.72 MB/s	   49581 B/op	      69 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/Double_CPU_Pair,_4096_Bytes
BenchmarkAsyncThroughputNetworkMultiple/Double_CPU_Pair,_4096_Bytes-16       	     423	   2768609 ns/op	 147.94 MB/s	  193468 B/op	     143 allocs/op
BenchmarkThroughputClient
BenchmarkThroughputClient/test
BenchmarkThroughputClient/test-16                                            	      33	  31325806 ns/op	1071.13 MB/s	    3754 B/op	      14 allocs/op
BenchmarkThroughputResponseClient
BenchmarkThroughputResponseClient/test
BenchmarkThroughputResponseClient/test-16                                    	      40	  28371455 ns/op	1182.66 MB/s	    2526 B/op	       7 allocs/op
BenchmarkThroughputServerSingle
BenchmarkThroughputServerSingle/test
BenchmarkThroughputServerSingle/test-16                                      	      40	  29028251 ns/op	1155.91 MB/s	    2008 B/op	       4 allocs/op
BenchmarkThroughputServerUnlimited
BenchmarkThroughputServerUnlimited/test
BenchmarkThroughputServerUnlimited/test-16                                   	      26	  44971115 ns/op	 746.12 MB/s	 7337589 B/op	  129577 allocs/op
BenchmarkThroughputServerLimited
BenchmarkThroughputServerLimited/test
BenchmarkThroughputServerLimited/test-16                                     	      25	 191308811 ns/op	 175.39 MB/s	 8296171 B/op	  136830 allocs/op
BenchmarkThroughputResponseServerSingle
BenchmarkThroughputResponseServerSingle/test
BenchmarkThroughputResponseServerSingle/test-16                              	      40	  28091104 ns/op	1194.47 MB/s	    2009 B/op	       3 allocs/op
BenchmarkThroughputResponseServerSlowSingle
BenchmarkThroughputResponseServerSlowSingle/test
BenchmarkThroughputResponseServerSlowSingle/test-16                          	       1	6063559261 ns/op	   5.53 MB/s	38243640 B/op	  260096 allocs/op
BenchmarkThroughputResponseServerSlowUnlimited
BenchmarkThroughputResponseServerSlowUnlimited/test
BenchmarkThroughputResponseServerSlowUnlimited/test-16                       	      26	  41813429 ns/op	 802.47 MB/s	 7113727 B/op	  131884 allocs/op
BenchmarkThroughputResponseServerSlowLimited
BenchmarkThroughputResponseServerSlowLimited/test
BenchmarkThroughputResponseServerSlowLimited/test-16                         	      13	  87307328 ns/op	 384.32 MB/s	 7595574 B/op	  134375 allocs/op
BenchmarkSyncThroughputPipe
BenchmarkSyncThroughputPipe/32_Bytes
BenchmarkSyncThroughputPipe/32_Bytes-16                                      	    5557	    215138 ns/op	  14.87 MB/s	    1856 B/op	     204 allocs/op
BenchmarkSyncThroughputPipe/512_Bytes
BenchmarkSyncThroughputPipe/512_Bytes-16                                     	    4981	    210954 ns/op	 242.71 MB/s	    1856 B/op	     204 allocs/op
BenchmarkSyncThroughputPipe/1024_Bytes
BenchmarkSyncThroughputPipe/1024_Bytes-16                                    	    4986	    210639 ns/op	 486.14 MB/s	    1857 B/op	     204 allocs/op
BenchmarkSyncThroughputPipe/2048_Bytes
BenchmarkSyncThroughputPipe/2048_Bytes-16                                    	    5792	    221797 ns/op	 923.37 MB/s	    1856 B/op	     204 allocs/op
BenchmarkSyncThroughputPipe/4096_Bytes
BenchmarkSyncThroughputPipe/4096_Bytes-16                                    	    5136	    233596 ns/op	1753.45 MB/s	    1858 B/op	     204 allocs/op
BenchmarkSyncThroughputNetwork
BenchmarkSyncThroughputNetwork/32_Bytes
BenchmarkSyncThroughputNetwork/32_Bytes-16                                   	    1554	    746555 ns/op	   4.29 MB/s	    1857 B/op	     204 allocs/op
BenchmarkSyncThroughputNetwork/512_Bytes
BenchmarkSyncThroughputNetwork/512_Bytes-16                                  	    1519	    775843 ns/op	  65.99 MB/s	    1856 B/op	     204 allocs/op
BenchmarkSyncThroughputNetwork/1024_Bytes
BenchmarkSyncThroughputNetwork/1024_Bytes-16                                 	    1514	    769814 ns/op	 133.02 MB/s	    1860 B/op	     204 allocs/op
BenchmarkSyncThroughputNetwork/2048_Bytes
BenchmarkSyncThroughputNetwork/2048_Bytes-16                                 	    1465	    785394 ns/op	 260.76 MB/s	    1863 B/op	     204 allocs/op
BenchmarkSyncThroughputNetwork/4096_Bytes
BenchmarkSyncThroughputNetwork/4096_Bytes-16                                 	    1522	    778954 ns/op	 525.83 MB/s	    1864 B/op	     204 allocs/op
BenchmarkAsyncThroughputLarge
BenchmarkAsyncThroughputLarge/1MB
BenchmarkAsyncThroughputLarge/1MB-16                                         	      63	  16363061 ns/op	6408.19 MB/s	   57882 B/op	       4 allocs/op
BenchmarkAsyncThroughputLarge/2MB
BenchmarkAsyncThroughputLarge/2MB-16                                         	      32	  33886271 ns/op	6188.80 MB/s	  302883 B/op	       5 allocs/op
BenchmarkAsyncThroughputLarge/4MB
BenchmarkAsyncThroughputLarge/4MB-16                                         	      16	  69927434 ns/op	5998.08 MB/s	  533142 B/op	       5 allocs/op
BenchmarkAsyncThroughputLarge/8MB
BenchmarkAsyncThroughputLarge/8MB-16                                         	       6	 169153072 ns/op	4959.18 MB/s	 5973632 B/op	      11 allocs/op
BenchmarkAsyncThroughputLarge/16MB
BenchmarkAsyncThroughputLarge/16MB-16                                        	       3	 369846874 ns/op	4536.26 MB/s	18222664 B/op	      19 allocs/op
BenchmarkSyncThroughputLarge
BenchmarkSyncThroughputLarge/1MB
BenchmarkSyncThroughputLarge/1MB-16                                          	      86	  13088227 ns/op	8011.60 MB/s	   62809 B/op	     204 allocs/op
BenchmarkSyncThroughputLarge/2MB
BenchmarkSyncThroughputLarge/2MB-16                                          	      38	  28169724 ns/op	7444.70 MB/s	  837967 B/op	     206 allocs/op
BenchmarkSyncThroughputLarge/4MB
BenchmarkSyncThroughputLarge/4MB-16                                          	      19	  63662245 ns/op	6588.37 MB/s	 1112895 B/op	     206 allocs/op
BenchmarkSyncThroughputLarge/8MB
BenchmarkSyncThroughputLarge/8MB-16                                          	       7	 143800609 ns/op	5833.50 MB/s	    1958 B/op	     205 allocs/op
BenchmarkSyncThroughputLarge/16MB
BenchmarkSyncThroughputLarge/16MB-16                                         	       4	 274422862 ns/op	6113.64 MB/s	    1992 B/op	     205 allocs/op
BenchmarkTCPThroughput
BenchmarkTCPThroughput/32_Bytes
BenchmarkTCPThroughput/32_Bytes-16                                           	   18932	     62562 ns/op	  51.15 MB/s	     304 B/op	       4 allocs/op
BenchmarkTCPThroughput/512_Bytes
BenchmarkTCPThroughput/512_Bytes-16                                          	   12949	     94038 ns/op	 544.46 MB/s	     304 B/op	       4 allocs/op
BenchmarkTCPThroughput/1024_Bytes
BenchmarkTCPThroughput/1024_Bytes-16                                         	    7903	    145599 ns/op	 703.30 MB/s	     304 B/op	       4 allocs/op
BenchmarkTCPThroughput/2048_Bytes
BenchmarkTCPThroughput/2048_Bytes-16                                         	    4556	    248212 ns/op	 825.10 MB/s	     304 B/op	       4 allocs/op
BenchmarkTCPThroughput/4096_Bytes
BenchmarkTCPThroughput/4096_Bytes-16                                         	    2577	    460770 ns/op	 888.95 MB/s	     304 B/op	       4 allocs/op
BenchmarkTCPThroughput/1MB
BenchmarkTCPThroughput/1MB-16                                                	      81	  13482764 ns/op	7777.16 MB/s	     304 B/op	       4 allocs/op
BenchmarkTCPThroughput/2MB
BenchmarkTCPThroughput/2MB-16                                                	      42	  27476133 ns/op	7632.63 MB/s	     304 B/op	       4 allocs/op
BenchmarkTCPThroughput/4MB
BenchmarkTCPThroughput/4MB-16                                                	      19	  58131680 ns/op	7215.18 MB/s	     304 B/op	       4 allocs/op
BenchmarkTCPThroughput/8MB
BenchmarkTCPThroughput/8MB-16                                                	       7	 147095060 ns/op	5702.85 MB/s	     304 B/op	       4 allocs/op
BenchmarkTCPThroughput/16MB
BenchmarkTCPThroughput/16MB-16                                               	       4	 304004459 ns/op	5518.74 MB/s	     304 B/op	       4 allocs/op
PASS
ok  	github.com/loopholelabs/frisbee-go	122.594s
?   	github.com/loopholelabs/frisbee-go/internal/dialer	[no test files]
goos: darwin
goarch: amd64
pkg: github.com/loopholelabs/frisbee-go/pkg/metadata
cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
BenchmarkEncode
BenchmarkEncode-16          	69372000	        17.52 ns/op
BenchmarkDecode
BenchmarkDecode-16          	214544335	         5.582 ns/op
BenchmarkEncodeDecode
BenchmarkEncodeDecode-16    	51931734	        22.23 ns/op
PASS
ok  	github.com/loopholelabs/frisbee-go/pkg/metadata	6.371s
PASS
ok  	github.com/loopholelabs/frisbee-go/pkg/packet	0.190s

Final Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] New and existing unit tests pass locally with my changes
  • [x] I have checked my code and corrected any misspellings
  • [x] I have signed-off my commits with git commit -s (see [the developer's certificate of origin]

nicolaenicora avatar Aug 31 '23 16:08 nicolaenicora