Skip to content

Instantly share code, notes, and snippets.

@gonchar
Last active January 2, 2016 21:38
Show Gist options
  • Save gonchar/8364361 to your computer and use it in GitHub Desktop.
Save gonchar/8364361 to your computer and use it in GitHub Desktop.
Crossbridge test
//
//
//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