Anyone one have a 30+mb text file?

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

BFG10K

Lifer
Aug 14, 2000
22,709
3,003
126
Then you can add 5 seconds for the original 100 character entry. Total time: 29 seconds.
You're right, it looks like I really over-estimated the time required.

char x[98];

strcpy(x, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&amp;&amp;*()_-+={}[]|\';:<>,.?/~`\"\n\t\\ \0");

This'll make it faster:
 

Armitage

Banned
Feb 23, 2001
8,086
0
0
Originally posted by: BFG10K
Then you can add 5 seconds for the original 100 character entry. Total time: 29 seconds.
You're right, it looks like I really over-estimated the time required.

char x[98];

strcpy(x, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&amp;&amp;*()_-+={}[]|\';:<>,.?/~`\"\n\t\\ \0");

This'll make it faster:

Nope ... one call to strcpy it trivial relative to 30000 times through that loop. It is prettier though.
 

BFG10K

Lifer
Aug 14, 2000
22,709
3,003
126
Nope ... one call to strcpy it trivial relative to 30000 times through that loop.
AFAIK const somtimes allows the compiler to generate faster code because it knows the variable can't be modified.
 

Armitage

Banned
Feb 23, 2001
8,086
0
0
Originally posted by: BFG10K
Nope ... one call to strcpy it trivial relative to 30000 times through that loop.
AFAIK const somtimes allows the compiler to generate faster code because it knows the variable can't be modified.

Yea, that's a good point. I did try it though, and it made no difference in the run tiime for this simple case.