Changeset b4107c8 for benchmark/creation/goroutine.go
- Timestamp:
- Jan 7, 2020, 3:50:56 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 580c11b
- Parents:
- 846c026
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/creation/goroutine.go
r846c026 rb4107c8 4 4 "fmt" 5 5 "time" 6 "flag" 6 7 ) 7 8 … … 17 18 18 19 func main() { 19 const NoOfTimes = 500000 20 times := flag.Int( "times", 500000, "loop iterations" ) 21 flag.Parse() 20 22 start := time.Now() 21 for i := 1; i <= NoOfTimes; i += 1 {23 for i := 1; i <= *times; i += 1 { 22 24 go noop() // creation 25 <- shake // wait for completion 23 26 } 24 27 end := time.Now() 25 fmt.Printf("%d\n", end.Sub(start) / time.Duration(NoOfTimes)) 26 <- shake 28 fmt.Printf( "%d\n", end.Sub(start) / time.Duration(*times) ) 27 29 } 30 31 // Local Variables: // 32 // tab-width: 4 // 33 // End: //
Note: See TracChangeset
for help on using the changeset viewer.