Last active
August 29, 2015 14:05
-
-
Save TyounanMOTI/ea85f0366511b8fb6c59 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
=== -std=C++98, -Os ====== | |
6.393718s wall, 1.480000s user + 4.110000s system = 5.590000s CPU (87.4%) | |
6.441048s wall, 2.010000s user + 3.770000s system = 5.780000s CPU (89.7%) | |
24.594495s wall, 5.680000s user + 13.500000s system = 19.180000s CPU (78.0%) | |
23.071802s wall, 5.590000s user + 12.920000s system = 18.510000s CPU (80.2%) | |
=== -std=C++11, -Os ====== | |
6.956083s wall, 1.510000s user + 4.330000s system = 5.840000s CPU (84.0%) | |
6.532527s wall, 2.030000s user + 3.820000s system = 5.850000s CPU (89.6%) | |
11.977692s wall, 4.160000s user + 5.210000s system = 9.370000s CPU (78.2%) | |
13.777258s wall, 4.620000s user + 5.380000s system = 10.000000s CPU (72.6%) |
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 <valarray> | |
#include <boost/timer/timer.hpp> | |
namespace { | |
float generator(float in) | |
{ | |
return in + 1.0f; | |
} | |
} | |
int main(void) | |
{ | |
const size_t LENGTH = 10e8; | |
{ | |
std::valarray<float> target(0.0f, LENGTH); | |
{ | |
boost::timer::auto_cpu_timer timer; | |
for (float* iter = &target[0]; iter != &target[0] + LENGTH; ++iter) { | |
*iter = generator(*iter); | |
} | |
} | |
} | |
{ | |
std::valarray<float> target(0.0f, LENGTH); | |
{ | |
boost::timer::auto_cpu_timer timer; | |
target += 1.0f; | |
} | |
} | |
{ | |
std::valarray<float> target(0.0f, LENGTH); | |
{ | |
boost::timer::auto_cpu_timer timer; | |
target = target.apply(generator); | |
} | |
} | |
{ | |
std::valarray<float> target(0.0f, LENGTH); | |
std::valarray<float> target_copy(0.0f, LENGTH); | |
{ | |
boost::timer::auto_cpu_timer timer; | |
target_copy = target.apply(generator); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment