file and "file -i"
Julian Field
MailScanner at ecs.soton.ac.uk
Sat Jan 12 19:44:00 UTC 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
What happens when you run, say, 30 files at a time through "file -i"
compared to File::Type?
I'm far more interested in the case when there are multiple command-line
arguments to the "file" command, as this represents the situation under
load, which is where speed counts.
Matt Hampton wrote:
> 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($_);
> }
> }
>
Jules
- --
Julian Field MEng CITP CEng
www.MailScanner.info
Buy the MailScanner book at www.MailScanner.info/store
MailScanner customisation, or any advanced system administration help?
Contact me at Jules at Jules.FM
PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
PGP public key: http://www.jules.fm/julesfm.asc
-----BEGIN PGP SIGNATURE-----
Version: PGP Desktop 9.7.0 (Build 1012)
Comment: Use Thunderbird's Enigmail add-on to verify this message
Charset: UTF-8
wj8DBQFHiRiCEfZZRxQVtlQRAuy9AJ9YdXoM0ARRqwOfLvEa4NAVtosYoQCcCyPq
nqs2VmKlFxAFkMKRRdT49zY=
=I49g
-----END PGP SIGNATURE-----
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the MailScanner-Beta
mailing list