Created
July 12, 2016 16:07
-
-
Save kana-sama/57aaec892b7229a568a609005cb7f483 to your computer and use it in GitHub Desktop.
Summtest
This file contains hidden or 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
| #include <iostream> | |
| #include <chrono> | |
| #include <cmath> | |
| int main() { | |
| double sum; | |
| auto start = std::chrono::system_clock::now(); | |
| for (double i = 0; i < 1000000; i++) { | |
| sum += std::sin(i); | |
| } | |
| auto stop = std::chrono::system_clock::now(); | |
| auto delta = std::chrono::duration_cast<std::chrono::milliseconds>(stop - start); | |
| std::cout << delta.count(); | |
| return 0; | |
| } |
This file contains hidden or 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" | |
| "math" | |
| "time" | |
| ) | |
| func f() { | |
| var sum float64 = 0 | |
| for i := float64(0); i < 1000000; i += 1 { | |
| sum += math.Sin(i) | |
| } | |
| } | |
| func main() { | |
| start := time.Now() | |
| f() | |
| fmt.Println(time.Now().Sub(start)) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment