source: benchmark/creation/goroutine.go @ b4107c8

arm-ehjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-expr
Last change on this file since b4107c8 was b4107c8, checked in by Peter A. Buhr <pabuhr@…>, 2 years ago

update existing benchmarks for changes to bench.h, add new benchmarks in new programming languages

  • Property mode set to 100644
File size: 602 bytes
Line 
1package main
2
3import (
4    "fmt"
5    "time"
6    "flag"
7)
8
9var shake chan bool = make( chan bool )
10
11func noop() {
12        shake <- true   // indicate completion
13}
14
15//=======================================
16// benchmark driver
17//=======================================
18
19func main() {
20        times := flag.Int( "times", 500000, "loop iterations" )
21        flag.Parse()
22        start := time.Now()
23        for i := 1; i <= *times; i += 1 {
24                go noop()               // creation
25                <- shake                // wait for completion
26        }
27        end := time.Now()
28        fmt.Printf( "%d\n", end.Sub(start) / time.Duration(*times) )
29}
30
31// Local Variables: //
32// tab-width: 4 //
33// End: //
Note: See TracBrowser for help on using the repository browser.