>At 1:02 PM -0500 03/06/96, Hal Wine wrote: >>This means you should either: >>a) do a chdir() to the supplied directory, then always do an opendir() >>on the current directory (':' for Mac, '.' for unix/dos). Or, >>b) always prepend the directory to the filename returned by readdir(). >> >>My hunch is (a) runs faster on the Mac (due to internals of the Mac >>file system), and no slower on other file systems. > >No, according to Matthias, a) shouldn't run faster. He said MacPerl fully >expands relative pathnames to absolute pathnames before doing anything with >them. Well, I hate to disagree with Matthias, but (a) DOES run faster, and works correctly, while (b) has bugs. (See attached script) Here's the timing for 10,000 stats of a directory where the path string is 223 characters, and 7 levels deep (excluding volume name): Perl 5.0.7r1m: 194 seconds for full path stat 120 seconds for relative stat MacPerl 4.1.8: 200 seconds for full path stat 126 seconds for relative stat So, we see that using a full path is about 60% slower than relative directories. Using a full path is limited to strings of less than 256 characters, and, there are some wierd things that happen at the extremity of that limit. In the attached script, the name of the final directory created gets truncated, without any error notice, in both MacPerl 4 & 5. I'm not sure when the conversion from relative to full path occurs. I tried combinations such as '::' and ':dir:dir' to see if I could force it, and I couldn't. Anyway, a very ugly test script is attached, purposely designed to show how NOT to write perl code ;-) If you use it, be sure to change the name of your test volume at the top of the code.... Attachment converted: ION2:dir test (TEXT/McPL) (0000C679) --Hal Hal Wine <hal@dtor.com> voice: 510/482-0597