Nai schrieb:Gesamtes Testprogramm dafür bitte![]()
Ich habe es noch ein bischen ergänzt. Neuer Vergleich:
32 Bit
64 Bit:
Werte in Millisekunden.
Code:
int8: 3651
int16: 3822
int32: 3853
int64: 4056
float: 5226
double: 17769
long double: 17908
Code:
int8: 748
int16: 749
int32: 733
int64: 749
float: 733
double: 733
long double: 749
Source:
Code:
#pragma hdrstop
#pragma argsused
#ifdef _WIN32
#include <tchar.h>
#else
typedef char _TCHAR;
#define _tmain main
#endif
#include <iostream>
const int ARRAY_LENGTH = 50000;
using namespace std;
void doInt8()
{
__int8 array[ARRAY_LENGTH];
double start = clock();
cout << "int8: ";
for (int j = 1; j < ARRAY_LENGTH; j++) {
array[0] = j;
for (int i = 1; i < ARRAY_LENGTH; i++) {
array[i] = array[i - 1]++;
}
}
cout << "\t\t" << clock() - start << endl;
}
void doInt16()
{
__int16 array[ARRAY_LENGTH];
double start = clock();
cout << "int16: ";
for (int j = 1; j < ARRAY_LENGTH; j++) {
array[0] = j;
for (int i = 1; i < ARRAY_LENGTH; i++) {
array[i] = array[i - 1]++;
}
}
cout << "\t\t" << clock() - start << endl;
}
void doInt32()
{
__int32 array[ARRAY_LENGTH];
double start = clock();
cout << "int32: ";
for (int j = 1; j < ARRAY_LENGTH; j++) {
array[0] = j;
for (int i = 1; i < ARRAY_LENGTH; i++) {
array[i] = array[i - 1]++;
}
}
cout << "\t\t" << clock() - start << endl;
}
void doInt64()
{
__int64 array[ARRAY_LENGTH];
double start = clock();
cout << "int64: ";
for (int j = 1; j < ARRAY_LENGTH; j++) {
array[0] = j;
for (int i = 1; i < ARRAY_LENGTH; i++) {
array[i] = array[i - 1]++;
}
}
cout << "\t\t" << clock() - start << endl;
}
void doFloat()
{
float array[ARRAY_LENGTH];
double start = clock();
cout << "float: ";
for (int j = 1; j < ARRAY_LENGTH; j++) {
array[0] = j;
for (int i = 1; i < ARRAY_LENGTH; i++) {
array[i] = array[i - 1]++;
}
}
cout << "\t\t" << clock() - start << endl;
}
void doDouble()
{
double array[ARRAY_LENGTH];
double start = clock();
cout << "double: ";
for (int j = 1; j < ARRAY_LENGTH; j++) {
array[0] = j;
for (int i = 1; i < ARRAY_LENGTH; i++) {
array[i] = array[i - 1]++;
}
}
cout << "\t" << clock() - start << endl;
}
void doLongDouble()
{
long double array[ARRAY_LENGTH];
double start = clock();
cout << "long double: ";
for (int j = 1; j < ARRAY_LENGTH; j++) {
array[0] = j;
for (int i = 1; i < ARRAY_LENGTH; i++) {
array[i] = array[i - 1]++;
}
}
cout << "\t" << clock() - start << endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
doInt8();
doInt16();
doInt32();
doInt64();
doFloat();
doDouble();
doLongDouble();
system("PAUSE");
return 0;
}