Author: Robert Hyatt
Date: 17:13:41 05/06/04
Go up one level in this thread
On May 06, 2004 at 17:23:48, Dieter Buerssner wrote:
>On May 05, 2004 at 11:53:33, Robert Hyatt wrote:
>
>>Question is, how much time? The directory contents will be cached. No I/O at
>>all will be done. It probably won't take a second although you could test that
>>with a dinky program that tries to open 33K bogus filenames in the same
>>directory...
>>
>>sample:
>>
>>#include <sys/types.h>
>>#include <sys/stat.h>
>>#include <fcntl.h>
>>#include <string.h>
>>main() {
>> char fname[6];
>> int fd;
>> int i;
>> for (i=0;i<33000;i++);
>> sprintf(fname,"%d",i);
>> fd = open(fname,O_RDONLY);
>> if (fd > 0) {
>> write(fd,fname,strlen(fname));
>> close(fd);
>> }
>>}
>>
>>On my 2.8 xeon, here is how long it takes to run:
>>
>>
>>
>>crafty% time ./tstopen
>>0.000u 0.000s 0:00.00 0.0% 0+0k 0+0io 75pf+0w
>
>Out of curiosity, I tried your example on Win XP with MSVC 6 and with Gcc 3.2.
>Took also practically zero time. BTW. Why do yo try to write to fd, that is
>opened read only?
I was afraid that if I didn't do something "useful" the compiler would use its
DAG and get rid of everything inside the loop, then the loop itself...
In unix the write will fail, but there were no files with that name so it never
tries....
>
>I tried a similar example, using Standard C functions (as does the Nalimov
>code):
>
>#include <stdio.h>
>
>int main(void)
>{
> FILE *fp;
> int i;
> char fname[16];
> for (i=0; i<33000; i++)
> {
> sprintf(fname, "%d", i);
> fp = fopen(fname, "rb");
> if (fp)
> fclose(fp);
> }
> return 0;
>}
>
>G:\src\yace>ptime h2
>
> Time of Execution: 00:00:07.75
>
>13 seconds with the Gcc compile.
>
>I also tried the time used to initialize the TBs on my computer. I have all
>3/4/5 men TBs and knnknn as the only 6-men TB (it is the smallest to download).
>I used the TB code from Crafty 19.12 egtb.cpp (almost) unmodified.
>
>Initializing TBs took 12 seconds. Setting the path for tbs to c:\notexist and
>initializing TBs (none were found, of course) took 6 seconds. setting it to
>"nul" (which should correspond to /dev/null in the Unix world): 5 s.
>Last I set tbldir \ne1; \ne2; \ne3; \ne4; \ne5 -> 23 s (obviously no HD accesses
>during this, HD light was dark). I repeated this with Virus scanner disabled -
>same result.
>
>No, it really does not bother me - but typically people will see much larger
>times than you see. My computer is not that slow - P4 2.53 GHz. The disk is very
>new, and I think rather fast for an IDE disk.
>
>Regards,
>Dieter
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.