source: benchmark/creation/goroutine.go @ 6e540ea

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 6e540ea was b4107c8, checked in by Peter A. Buhr <pabuhr@…>, 4 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
RevLine 
[50abab9]1package main
2
3import (
4    "fmt"
5    "time"
[b4107c8]6    "flag"
[50abab9]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() {
[b4107c8]20        times := flag.Int( "times", 500000, "loop iterations" )
21        flag.Parse()
[50abab9]22        start := time.Now()
[b4107c8]23        for i := 1; i <= *times; i += 1 {
[50abab9]24                go noop()               // creation
[b4107c8]25                <- shake                // wait for completion
[50abab9]26        }
27        end := time.Now()
[b4107c8]28        fmt.Printf( "%d\n", end.Sub(start) / time.Duration(*times) )
[50abab9]29}
[b4107c8]30
31// Local Variables: //
32// tab-width: 4 //
33// End: //
Note: See TracBrowser for help on using the repository browser.