Created
February 4, 2022 14:30
-
-
Save kaityo256/9392bb3984afcdd45d0cb868036788fd to your computer and use it in GitHub Desktop.
Trad vs. Clang
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
#include <cstdio> | |
#include <algorithm> | |
#include <random> | |
int main(){ | |
std::mt19937 mt; | |
double s = 0.0; | |
std::uniform_real_distribution<double> ud(0.0, 1.0); | |
for (int i = 0; i < 1000000; i++) s+=ud(mt); | |
printf("%f\n",s); | |
} |
In the interactive queue.
$ g++ -O3 -std=c++11 main.cpp -o gcc.out
$ time ./a.out
$ time ./gcc.out
500044.868973
real 0m0.256s
user 0m0.255s
sys 0m0.000s
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compile.
Run (in the interactive queue).