Last active
January 2, 2016 21:38
-
-
Save gonchar/8364361 to your computer and use it in GitHub Desktop.
Crossbridge test
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
// | |
// | |
//Time: | |
// | |
//0.195312 - All browsers with FlashPlayer 11.9 release http://i.imgur.com/0WrbiVP.png | |
//0.203 - exe compiled with MSVC in release http://i.imgur.com/9aUm4TZ.png | |
// | |
//Download swf - https://www.dropbox.com/s/0vwvvo04d179gef/speedTest.swf | |
// | |
//Compile in Crossbridge /cygdrive/c/flascc/sdk/usr/bin/g++.exe speedTest.cpp -O4 -emit-swf -o speedTest.swf | |
// | |
// | |
#include <stdio.h> | |
#include <ctime> | |
#include <math.h> | |
#include <iostream> | |
using namespace std; | |
#define LIMIT 10000000 | |
int main() { | |
double a; | |
int i; | |
clock_t begin = clock(); | |
for (i = 1; i != LIMIT; i++) { | |
a = exp(i / 1000.0); | |
} | |
for (i = 1; i != LIMIT; i++) { | |
a = sin(i / 1000.0); | |
} | |
clock_t end = clock(); | |
double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC; | |
printf("Time: %f\n", elapsed_secs); | |
printf("Result: %f\n", a); | |
system("pause"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment