Created
February 5, 2020 14:21
-
-
Save kaityo256/739f6992304c657c68f845461e9ee87d to your computer and use it in GitHub Desktop.
Intel Compiler vs. GCC
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 <random> | |
| struct myrand { | |
| uint32_t operator()() { | |
| static uint32_t y = 2463534242; | |
| y = y ^ (y << 13); y = y ^ (y >> 17); | |
| return y = y ^ (y << 5); | |
| } | |
| uint32_t max(){ | |
| return std::mt19937::max(); | |
| } | |
| uint32_t min(){ | |
| return 0; | |
| } | |
| }; | |
| double run(void) { | |
| myrand mt; | |
| double r = 0.0; | |
| std::uniform_real_distribution<> ud(-1.0, 1.0); | |
| for (int j = 0; j <10000; j++) { | |
| for (int i = 0; i < 10000; i++) { | |
| if (i%2) r += ud(mt); | |
| } | |
| } | |
| return r; | |
| } | |
| int main(){ | |
| std::cout << run() << std::endl; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
The Intel compiler is 17.5x slower than GCC.