mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-10-31 09:15:07 +03:00 
			
		
		
		
	first code/readme/license commit
This commit is contained in:
		
							parent
							
								
									35852be36d
								
							
						
					
					
						commit
						d7e6d814a0
					
				
					 60 changed files with 9768 additions and 2 deletions
				
			
		
							
								
								
									
										22
									
								
								misc/tests/goroutine-test.go
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								misc/tests/goroutine-test.go
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| package main | ||||
| 
 | ||||
| import "sync" | ||||
| import "time" | ||||
| import "fmt" | ||||
| 
 | ||||
| func main () { | ||||
|   const reqs = 1000000 | ||||
|   var wg sync.WaitGroup | ||||
|   start := time.Now() | ||||
|   for idx := 0 ; idx < reqs ; idx++ { | ||||
|     wg.Add(1) | ||||
|     go func () { wg.Done() } () | ||||
|   } | ||||
|   wg.Wait() | ||||
|   stop := time.Now() | ||||
|   timed := stop.Sub(start) | ||||
|   fmt.Printf("%d goroutines in %s (%f per second)\n", | ||||
|              reqs, | ||||
|              timed, | ||||
|              reqs/timed.Seconds()) | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue