Page MenuHome
Paste P1066

C++11 thread_local benchmark program (MSVC)
ActivePublic

Authored by Julian Eisel (Severin) on Aug 6 2019, 6:12 PM.
#include <iostream>
#include <cmath>
static thread_local double number;
//static double number;
static __declspec(noinline) double getNumber()
{
return number;
}
static void test()
{
printf("start\n");
double res = 0.0;
number = 1.0;
for (int i = 0; i < 1000000000; i++) {
res += sqrt(getNumber());
}
printf("%f\n", res);
}
int main()
{
test();
return 0;
}

Event Timeline

Julian Eisel (Severin) changed the title of this paste from C++11 thread_local benchmark program to C++11 thread_local benchmark program (MSVC).
Julian Eisel (Severin) updated the paste's language from autodetect to cpp.