[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] more info from FSpGetFInfo



O.K. - one step further.
Three remarks about documentation, speed and FSpIterateDirectory.

>At 18.33 1998.02.25, Axel Rose wrote:
>>Just wondering whether the additional stat() could be
>>saved if FSpGetFInfo() could return creation time,
>>modification time and size.


1.(documentation)
>Chris Nandor wrote:
>Anyway, you can also use FSpGetCatInfo instead, which offers other fields.
>
>creation time   ioFlCrDat
>mod time        ioFlMdDat

Right - this works but it is undocumented.
Files.pm says nothing about ioFlCrDat and ioFlMdDat.
I found it in Files.xs.

>Paul J. Schinder wrote:
> you type, creator, and the size of both forks. Judging from
> :ext:Mac:Files:t:Files.t, it also gives the modification date, and

I deleted the ext Folder due to an older Mail from Matthias, saying
"Used only for documentation purposes in the binary release. Delete."


2. (performance)
stat() is at least twice as fast as getting mtime info through
FSpGetCatInfo().
See my example program and the results in the end.

3. (FSpIterateDirectory)
With FSpIterateDirectory() is there a way to prevent resolving
aliases? When working over my System folder all aliases in
"Recent Servers" are accessed.


Thanks for the unbelievable fast help so far


Axel

example program:
----------------
#!perl

$DEBUG=0;

use Mac::Files;
use Mac::MoreFiles;

$start = time();

$i=0;
FSpIterateDirectory("1000:Programme:POVRAY 3.01", 0, DoThis, "");

$i=0;
while ( $files[$i] )
{
	$finfo = FSpGetCatInfo( $files[$i] );
	# $type = $finfo->fdType();
	# available through FSpGetFInfo()
	# $ctime = localtime($finfo->ioFlCrDat());
	$mtime = localtime($finfo->ioFlMdDat());
	print "$files[$i]\n$finfo\tmod time = $mtime\n" if $DEBUG;
	$i++;
}
$runtime = time() - $start;
print "mtime through FSpGetCatInfo(): runtime (seconds) = $runtime\n";

$start = time();

$i=0;
while ( $files[$i] )
{
	@fstat = stat( $files[$i] );
	$mtime = localtime( $fstat[9] );
	print "$files[$i]\n$finfo\tmod time = $mtime\n" if $DEBUG;
	$i++;
}
$runtime = time() - $start;
print "mtime through stat(): runtime (seconds) = $runtime\n";

sub DoThis {
#	print $_[1], $_[0], "\n";
	$files[$i]=$_[0];
	$i++;
	return 0;
}
-----------------
results:
mtime through FSpGetCatInfo(): runtime (seconds) = 11
mtime through stat(): runtime (seconds) = 5

relation remains stable even with changing order of methods


---
<-:   Axel Rose, SPRINGER & JACOBY Digtal GmbH & Co. KG    :->
<-:                    mailto:rose@sj.com                  :->
PGP key 1024/A21CB825 E0E4 BC69 E001 96E9  2EFD 86CA 9CA1 AAC5
<-:   "Alles was entsteht ist Wert, da§ es zugrunde geht"  :->



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch