Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/creation/goroutine.go

    r50cfa99 rbf71cfd  
    22
    33import (
    4         "fmt"
    5         "time"
    6         "os"
    7         "strconv"
     4    "fmt"
     5    "time"
    86)
    97
     
    1917
    2018func main() {
    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 
     19        const NoOfTimes = 500000
    2520        start := time.Now()
    26         for i := 1; i <= times; i += 1 {
     21        for i := 1; i <= NoOfTimes; i += 1 {
    2722                go noop()               // creation
    28                 <- shake                // wait for completion
    2923        }
    3024        end := time.Now()
    31         fmt.Printf( "%d\n", end.Sub(start) / time.Duration(times) )
     25        fmt.Printf("%d\n", end.Sub(start) / time.Duration(NoOfTimes))
     26        <- shake
    3227}
    33 
    34 // Local Variables: //
    35 // tab-width: 4 //
    36 // End: //
Note: See TracChangeset for help on using the changeset viewer.