[gambit-list] Speed improvement of lib/digest.scm
Bradley Lucier
lucier at math.purdue.edu
Wed Nov 18 13:50:25 EST 2009
On Wed, 2009-11-18 at 13:05 -0500, Bradley Lucier wrote:
> On Thu, 2009-02-19 at 17:07 -0500, Marc Feeley wrote:
> >
> > On 19-Feb-09, at 4:57 PM, Marc Feeley wrote:
> >
> > > On my 2GHz Mac Book Pro:
> > >
> > > For MD5: 0.06 seconds per MB.
> > > For SHA-1: 0.13 seconds per MB.
> > >
> > > That's still about 3 times slower than the "md5" utility on my
> > > machine, but still not too bad for bit-bashing code entirely written
> > > in Scheme.
> >
> > By the way this slowdown is due to the 16-bit algorithms which are
> > used to perform the computations without overflowing the fixnums. The
> > C version probably does 32-bit operations, which is at least a factor
> > of 2 faster, and probably more when shifts are involved.
>
> And on my 64-bit Core 2 duo running ubuntu it's quite a bit worse:
>
> > (time (digest#digest-file "Fedora-12-ppc-DVD.iso" 'sha-1))
> (time (digest#digest-file "Fedora-12-ppc-DVD.iso" 'sha-1))
> 245908 ms real time
> 244740 ms cpu time (241710 user, 3030 system)
> no collections
> 12312 bytes allocated
> 8 minor faults
> no major faults
> "548e1b544c400d39be4fbd080080424e2b5c7674"
> heine:~/Desktop/Fedora-12-ppc-DVD> time sha1sum Fedora-12-ppc-DVD.iso
> 548e1b544c400d39be4fbd080080424e2b5c7674 Fedora-12-ppc-DVD.iso
> 18.390u 1.670s 2:03.13 16.2% 0+0k 1160296+0io 0pf+0w
and for sha-256 it's much worse:
> (time (digest#digest-file "Fedora-12-ppc-DVD.iso" 'sha-256))
(time (digest#digest-file "Fedora-12-ppc-DVD.iso" 'sha-256))
860775 ms real time
860580 ms cpu time (853140 user, 7440 system)
no collections
12600 bytes allocated
36 minor faults
no major faults
"800ef4f121e178dcc9c8dc128825021949abe0d6d029f36cd47e39a4033c3aaa"
>
*** EOF again to exit
heine:~/Desktop/Fedora-12-ppc-DVD> time sha256sum Fedora-12-ppc-DVD.iso
800ef4f121e178dcc9c8dc128825021949abe0d6d029f36cd47e39a4033c3aaa Fedora-12-ppc-DVD.iso
28.850u 1.190s 0:30.04 100.0% 0+0k 0+0io 0pf+0w
More information about the Gambit-list
mailing list