Changeset bdfc032 for benchmark/creation/goroutine.go
- Timestamp:
- Feb 4, 2020, 11:35:26 AM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- eef8dfb
- Parents:
- aefb247 (diff), 4f7b418 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/creation/goroutine.go
raefb247 rbdfc032 2 2 3 3 import ( 4 "fmt" 5 "time" 4 "fmt" 5 "time" 6 "os" 7 "strconv" 6 8 ) 7 9 … … 17 19 18 20 func main() { 19 const NoOfTimes = 500000 21 var times int = 10000000 22 if len( os.Args ) > 2 { os.Exit( 1 ) } 23 if len( os.Args ) == 2 { times, _ = strconv.Atoi(os.Args[1]) } 24 20 25 start := time.Now() 21 for i := 1; i <= NoOfTimes; i += 1 {26 for i := 1; i <= times; i += 1 { 22 27 go noop() // creation 28 <- shake // wait for completion 23 29 } 24 30 end := time.Now() 25 fmt.Printf("%d\n", end.Sub(start) / time.Duration(NoOfTimes)) 26 <- shake 31 fmt.Printf( "%d\n", end.Sub(start) / time.Duration(times) ) 27 32 } 33 34 // Local Variables: // 35 // tab-width: 4 // 36 // End: //
Note:
See TracChangeset
for help on using the changeset viewer.