Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^7: Assistance with file compare

by ramlight (Friar)
on Oct 28, 2009 at 21:26 UTC ( #803808=note: print w/replies, xml ) Need Help??


in reply to Re^6: Assistance with file compare
in thread Assistance with file compare

I would think that getting the file size is faster than computing the hash for the file. So it seems to me that pruning the list of files for which hashes have to be computed by comparing file sizes would be faster, especially for large numbers of files.

I am curious to know why your second method is better for many files. Could you enlighten me please?

Replies are listed 'Best First'.
Re^8: Assistance with file compare
by ikegami (Patriarch) on Oct 28, 2009 at 21:38 UTC

    I would think that getting the file size is faster than computing the hash for the file.

    You shouldn't be doing either. It should have been done for free when the file was written.

    If you didn't, you could compare files in a clever order and calculate their hash as they are being compared. This may save you from having to do more compares.

    So it seems to me that pruning the list of files for which hashes have to be computed by comparing file sizes would be faster, especially for large numbers of files.

    As the number of files grows, the number of collisions in file size grows.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://803808]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2022-08-13 12:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?