Re: TextOut() to a DialogBox ???
"Geoff" <geoff@invalid.invalid> wrote in message
news:ko9lq5htlr6517m0bu8j8h11qa4c690mek@4ax.com...
On Wed, 24 Mar 2010 16:32:39 -0700 (PDT), Malachy Moses
<malachy.moses@gmail.com> wrote:
I apologize for the ad hominem attack. Although it's
unlike me, I am
compelled by the vast quantities of fine resources (from
the likes of
Joe and Hector) that are being wasted on this stuff.
ditto
His style sucks too. I assumed he meant to write this:
typedef unsigned int uint32;
const uint32 size = 100000000;
std::vector<uint32> Data;
uint32 Max = 0x3fffffff;
void Process()
{
clock_t finish;
clock_t start;
double duration;
uint32 num;
Data.resize(size);
start = clock();
for (uint32 N = 0; N < size; N++)
num = Data[N];
finish = clock();
duration = (double)(finish - start) / CLOCKS_PER_SEC;
printf("%4.2f Seconds\n", duration);
}
It is not bad style, but, it can benefit from critique.
This is required to implement a very simple finite state
machine
num = Data[num];
Here is a re-write. I don't know why I am only getting 121
MB/Sec of the 12 GB/Sec RAM speed
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <time.h>
//#define uint32 unsigned int
typedef unsigned int uint32;
const uint32 size = 100000000;
std::vector<uint32> Data;
uint32 Max = 0x3fffffff;
double Process() {
long long Sum = 0;
clock_t finish;
clock_t start = clock();
double duration;
uint32 num = 0;
for (uint32 N = 0; N < Max; N++)
num = Data[num];
finish = clock();
duration = (double)(finish - start) / CLOCKS_PER_SEC;
return duration;
}
void Initialize() {
Data.resize(size);
for (uint32 N = 0; N < size; N++) {
uint32 Random = rand() * rand();
Random %= size;
Data[N] = Random;
}
char N;
printf("Hit any key to Continue:");
scanf("%c", &N);
}
int main() {
double duration;
double MBperSec;
printf("Size in bytes--->%d\n", size * 4);
Initialize();
duration = Process();
MBperSec = (double)(Max * 4) / (duration * 1024 * 1024);
printf("%4.2f Seconds %4.2f Megabytes Per Second\n",
duration, MBperSec);
return 0;
}
cpp.bat
cl -EHsc -O2 %1.cpp