file and "file -i"
Matt Hampton
matt at coders.co.uk
Mon Jan 7 13:35:13 UTC 2008
Steve Freegard wrote:
> UxBoD wrote:
>> Hmmm, using a perl module would be a good idea Steve. I wonder what
>> the performance differential would be ?
>>
A very quick benchmark
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
Platform:
osname=linux, osvers=2.6.9-42.0.3.elsmp,
archname=i386-linux-thread-multi
10516 Files ( assorted contents of my home directory so lots of source
code object files etc)
It is a busy box with not much memory so
Using file:
real 0m54.797s
user 0m19.825s
sys 0m30.454s
Using File::Type
real 0m27.974s
user 0m11.161s
sys 0m1.297s
A list of files was created in a text file (to stop the find process
being timed) and the script (below) was run as follows:
time ./testfile.pl < list.files > /dev/null
---------
#!/usr/bin/perl
if (0) {
while (<>) {
chomp;
print `file '$_'`
}
}
else {
use File::Type;
my $ft = File::Type->new();
while (<>) {
chomp;
print $_."\t".$ft->checktype_filename($_);
}
}
More information about the MailScanner-Beta
mailing list