[EMAIL PROTECTED] wrote:

I've written some files to go into examples/benchmark which time the
raw throughput of the md5 part, which excluding the load/compile
phases.

That's not really needed. Startup time is almost nothing with file sizes bigger then some MB. And below that, you don't get reasonable timings.


We can compare Digest::MD5 and python's md5sum.py against parrot -j. Both competitors are written in C --that's fine.

We're about a quarter of the throughput of pure C, which I think is darn good.

Yep, but let's compare with perl XS - we are around 1/2 perl XS speed now, see below.


(And we outperformed the pure Perl version by quite a bit, although
I'm guessing the slow core has similar timings)

Well, we are comparing a pure Parrot version with a pure Perl version ;-)

Now its your turn to process files blockwise ;-)

I'll see what I can do over the weekend. I'm not totally convinced that
the reduced memory consumption merits the extra code, but we'll see.

No extra code neeeded, just a bit different - have a look at Python's md5*.c - written very clearly + OO interface.


Ok lets compare some real time numbers:

                          parrot -j      perl XS     Python md5c.c
md5sum of
core (~400KB) [1]           0.10          0.07         0.06
ops/core_ops.c (~1MB) [2]   0.16          0.10         0.09
parrot (~4.5MB)    [3]      0.50          0.25         0.22
perl-5.8.0.tar.gz(11MB)[4]  1.07          0.51         0.44
22mb [5]                    2.10          0.98         0.86
100mb [6]                  14.0           4.26         3.73

leo

[1]   401408 bytes
[2]  1014056
[3]  4725838
[4] 11023084
[5] 22528000    # dd if=/dev/zero of=22mb  count=4400
[6]102400000    #                 of=100mb count=20000


programs used: perl 5.8.0, python 2.4, parrot svn head

$ time parrot -j md5sum.pbc the_file       # changed to load MD5.pbc
and of course JIT/x86 with these recent hacks ;-)

$ time python ~/src/Python-2.4/Tools/scripts/md5sum.py the_file

$ time perl md5.pl the_file

$ l ~/src/perl-5.8.0.tar.gz
[..]    11023084 Nov 30  2002 /home/lt/src/perl-5.8.0.tar.gz

# cat md5.pl

use lib 'lib';
#use Digest::Perl::MD5;
use Digest::MD5;

my $file = shift;
open(FILE, $file) or die "Can't open '$file': $!";
binmode(FILE);

# print Digest::Perl::MD5->new->addfile(*FILE)->hexdigest, " $file\n";
print Digest::MD5->new->addfile(*FILE)->hexdigest, " $file\n";



  • md5 timings (was: [PATCH] Cosmetic updates to MD5 library) Leopold Toetsch

Reply via email to