Ok, folk, time to try again. It’s nothing to do with SHA-1.
I deleted the SHA-1 update from the code so it’s the same
as “cat file >/dev/null”, and it takes ages:
$ time cat /tmp/ten_megabytes >/dev/null
real 0m0.040s
user 0m0.000s
sys 0m0.040s
$ time ruby cat.rb /tmp/ten_megabytes
real 0m1.262s
user 0m1.230s
sys 0m0.030s
$ time ruby sha1.rb /tmp/ten_megabytes
8c206a1a87599f532ce68675536f0b1546900d7a /tmp/ten_megabytes
real 0m1.693s
user 0m1.600s
sys 0m0.090s
$ time perl cat.pl < /tmp/ten_megabytes >/dev/null
real 0m0.044s
user 0m0.010s
sys 0m0.030s
I gotta say folk, this is going to make it very hard to convince others
here to use ruby, and that’s a shame… 30 times slower than Perl?!!
Code available on request.
Clifford Heath