This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: Re: find . -regex '.*js' -type f -exec md5sum '{}' \\; really slow!
The following may technically be off-topic. If so, I apologize.
Matthew Woehlke wrote on Monday, November 24, 2008 12:46 PM:
> Bartolomeo Nicolotti wrote:
>> but the command
>>
>> find . -type f | xargs md5sum
>>
>> has problems with blanks in the name of the files:
>> [snip examples]
>
> find . -type f -print0 | xargs -0 md5sum
I've found that find is significantly slower than native tools. (The following was run several times to fill any cached file system data.)
local hard disk (C:):
> time "$(cygpath -u "${COMSPEC}")" /c dir /s /b /a:-d | wc
16085 16308 690388
real 0m0.343s
user 0m0.122s
sys 0m0.170s
networked drive:
> time "$(cygpath -u "${COMSPEC}")" /c dir /s /b /a:-d | wc
1183 3093 66761
real 0m3.078s
user 0m0.075s
sys 0m0.108s
> time find . -type f | wc ")" /c d
1183 3093 53748
real 1m0.813s
user 0m0.216s
sys 0m8.046s
Therefore, you might consider using something like this if there are no symbolic links* and it doesn't offend your sensibilities. (* and other "oddities". I'm not sure how symbolic links work with find . -type f, so this might not be a problem.)
"$(cygpath -u "${COMSPEC}")" /c dir /s /b /a:-d | \
tr -s '\r\n' '\n' | \
cygpath -u -f - | \
tr '\n' '\0' | \
xargs -r0 md5sum
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/