Created
October 14, 2019 10:10
-
-
Save Mayankgupta688/f94f92907a601d9c44da10bef08d421b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
"runtime" | |
) | |
func main() { | |
runtime.GOMAXPROCS(4) | |
start := time.Now() | |
go func() { | |
for i:=0; i < 3; i++ { | |
fmt.Println(i) | |
} | |
}() | |
go func() { | |
for i:=0; i < 3; i++ { | |
fmt.Println(i) | |
} | |
}() | |
elapsedTime := time.Since(start) | |
fmt.Println("Total Time For Execution: " + elapsedTime.String()) | |
time.Sleep(time.Second) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment