Slow operation of md5sum in RedHat Linux 7.2 - a fix with explanation

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

 



Hi,

After installing Enigma on my home machine I was wondering why md5sum was
so much slower than on RedHat Linux 6.2 (actually about 3.5 times slower,
which was even slower than disk transfer rate on my machine);

As a workaround I just copied md5sum from RedHat Linux 6.2 installation
 and used if for larger files.

I have recently investigated this a bit, and have found that this is
because textutils package in RHL7.2 is compiled without optimizations;

Could you please consider removing 
%define optflags -g
line (just before %configure) from textutils.spec ? (a diff is included at
the bottom of the mail)

This is what disabled standard -O2 -mcpu.... setting from 
/usr/lib/rpm/*/macros;

Without -O2 the new cleanup in md5.h to use inline function rol instead of
macros results in calls to out-of-line function which further hurts
performance.

Please see results of the change (compiled and run on my box at work,
which runs RedHat Linux 6.2 on PentiumII 450MHz, intel 440BX chipset,
egcs-1.1.2-30 compiler);

I get 100MBytes from /dev/zero and run:
- md5sum (standard from RedHat Linux 6.2 most recent textutils update);
- ./md5sum_nooptflsp - built from textutils-2.0.14-2.src.rpm taken from
   RedHat Linux 7.2, after removing optflags
- ./md5sum_O3       - same, but insteat of removing optflags, I changed it 
  to    %define optflags -O3 -march=i386 -mcpu=i686
- ./md5sum_tu2014_RHL62 - built with original spec file

$ for pg in /usr/bin/md5sum ./md5sum_nooptflsp ./md5sum_O3 \
./md5sum_tu2014_RHL62; do echo == $pg ==; dd if=/dev/zero bs=4k \
count=$((1024/4*100)) | time $pg -b; done 

== /usr/bin/md5sum ==
25600+0 records in
25600+0 records out
2f282b84e7e608d5852449ed940bfc51 *-
2.30user 0.15system 0:02.79elapsed 87%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (102major+11minor)pagefaults 0swaps
== ./md5sum_nooptflsp ==
25600+0 records in
25600+0 records out
2f282b84e7e608d5852449ed940bfc51 *-
2.29user 0.36system 0:03.05elapsed 86%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (103major+11minor)pagefaults 0swaps
== ./md5sum_O3 ==
25600+0 records in
25600+0 records out
2f282b84e7e608d5852449ed940bfc51 *-
2.40user 0.32system 0:03.03elapsed 89%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (103major+11minor)pagefaults 0swaps
== ./md5sum_tu2014_RHL62 ==
25600+0 records in
25600+0 records out
2f282b84e7e608d5852449ed940bfc51 *-
9.53user 0.36system 0:10.22elapsed 96%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (104major+11minor)pagefaults 0swaps


$ for pg in /usr/bin/md5sum ./md5sum_nooptflsp ./md5sum_O3 \
./md5sum_tu2014_RHL62; do echo == $pg ==; dd if=/dev/zero bs=4k \
count=$((1024/4*100)) | time $pg -b; done 
== /usr/bin/md5sum ==
25600+0 records in
25600+0 records out
2f282b84e7e608d5852449ed940bfc51 *-
2.37user 0.17system 0:02.81elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (102major+11minor)pagefaults 0swaps
== ./md5sum_nooptflsp ==
25600+0 records in
25600+0 records out
2f282b84e7e608d5852449ed940bfc51 *-
2.36user 0.28system 0:03.02elapsed 87%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (103major+11minor)pagefaults 0swaps
== ./md5sum_O3 ==
25600+0 records in
25600+0 records out
2f282b84e7e608d5852449ed940bfc51 *-
2.28user 0.39system 0:03.02elapsed 88%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (103major+11minor)pagefaults 0swaps
== ./md5sum_tu2014_RHL62 ==
25600+0 records in
25600+0 records out
2f282b84e7e608d5852449ed940bfc51 *-
9.51user 0.38system 0:10.30elapsed 96%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (104major+11minor)pagefaults 0swaps


As you can see, -O3 does not improve the performance with respect to -O2, which
is still about 7% behind RedHat Linux 6.2; md5sum build from original spec file
runs more than 3 times slower.

The number might change a bit when textutils is compiled on RedHat Linux 7.2.

I have not checked how the change would affect other programs from textutils,
but I hope it would not hurt.

Best regards,

Wojtek
--------------------
Wojtek Pilorz
Wojtek.Pilorz@bdk.pl

spec file diff follows:

--- textutils.spec.org	Tue Aug 14 21:45:23 2001
+++ textutils.spec	Thu Feb 21 09:31:19 2002
@@ -22,7 +22,6 @@
 %build
 
 unset LINGUAS || :
-%define optflags -g
 %configure
 make
 






[Index of Archives]     [Kernel Newbies]     [Red Hat General]     [Fedora]     [Red Hat Install]     [Linux Kernel Development]     [Yosemite News]

  Powered by Linux