Last active
August 29, 2015 14:08
-
-
Save Mischa-Alff/bd0da2826a71f70dff10 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
#include <chrono> | |
#include <iostream> | |
#include <fea/util/noise.hpp> | |
int main() | |
{ | |
fea::Noise noise; | |
uint64_t min(-1), max(0), avg(0); | |
int steps = 10; | |
for(int n=0; n < steps; ++n) | |
{ | |
auto start = std::chrono::high_resolution_clock::now(); | |
for(unsigned int i=0; i < 100000000; ++i) | |
{ | |
noise.simplexOctave3D(i*0.1f, i*2.f, i*3.f); | |
} | |
auto end = std::chrono::high_resolution_clock::now(); | |
uint64_t current = std::chrono::duration_cast<std::chrono::microseconds>(end-start).count(); | |
std::cout<<"Step: "<<current<<"us"<<std::endl; | |
min = std::min(current, min); | |
max = std::max(current, max); | |
avg += current; | |
} | |
avg /= steps; | |
std::cout<<"Times (min, max, avg): "<<min<<"us, "<<max<<"us, "<<avg<<"us"<<std::endl; | |
} | |
/* | |
Built on ArchLinux x86_64 with GCC 4.9.1 | |
Featherkit-util linked as static library | |
CPU: Intel Core i7 4770 @ 3.4 GHz | |
(Tests were performed with TurboBoost on, and the clock speed was 3.75GHz) | |
NI marks "No Improvement" | |
Featherkit: C++ Noise: | |
- Featherkit: Optimizations = -O3: | |
- Benchmark: No optimizations: | |
- min: 18598904us (18.59s) | |
- max: 18811096us (18.81s) | |
- avg: 18642994us (18.64s) | |
- Benchmark: Optimizations = -O3: | |
- min: 18225107us (18.22s) | |
- max: 18428804us (18.42s) | |
- avg: 18273183us (18.27s) | |
- Benchmark: Optimizations = -O3 -msse4 -mfpmath=sse | |
- min: 18220874us (18.22s) | |
- max: 18444949us (18.44s) | |
- avg: 18268383us (18.26s) | |
- Benchmark: Optimizations = -O3 -msse4 -mfpmath=sse -march=native | |
- min: 18190438us (18.19s) | |
- max: 18379250us (18.37s) | |
- avg: 18269299us (18.26s) | |
- Featherkit: Optimizations = -O3 -msse4 -mfpath=sse | |
- Benchmark: No optimizations: | |
- min: 18428852us (18.42s) | |
- max: 18611255us (18.61s) | |
- avg: 18491360us (18.49s) | |
- Benchmark: Optimizations = -O3: | |
- min: NI | |
- max: NI | |
- avg: NI | |
- Benchmark: Optimizations = -O3 -msse4 -mfpmath=sse | |
- min: NI | |
- max: NI | |
- avg: NI | |
- Benchmark: Optimizations = -O3 -msse4 -mfpmath=sse -march=native | |
- min: NI | |
- max: NI | |
- avg: NI | |
Featherkit: ASM Noise: | |
- Featherkit: Optimizations = -O3: | |
- Benchmark: No optimizations: | |
- min: 17569558us (17.56s) | |
- max: 18067037us (18.06s) | |
- avg: 17710227us (17.71s) | |
- Benchmark: Optimizations = -O3: | |
- min: 17260683us (17.26s) | |
- max: 17342005us (17.34s) | |
- avg: 17283750us (17.28s) | |
- Benchmark: Optimizations = -O3 -msse4 -mfpmath=sse | |
- min: 17280764us (17.28s) | |
- max: 17475024us (17.47s) | |
- avg: 17357192us (17.35s) | |
- Benchmark: Optimizations = -O3 -msse4 -mfpmath=sse -march=native | |
- min: 17323757us (17.32s) | |
- max: 17550231us (17.55s) | |
- avg: 17378784us (17.37s) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment