From: Dave Thomas Date: 2002-06-20T15:01:53+09:00 Subject: Re: Why is I/O slow? Clifford Heath writes: > 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. dave[/tmp 0:58:39] cat >cat.rb print $stdin.read dave[/tmp 0:59:42] time cat <12meg >/dev/null cat < 12meg > /dev/null 0.00s user 0.05s system 102% cpu 0.049 total dave[/tmp 0:59:52] time ruby cat.rb <12meg >/dev/null ruby cat.rb < 12meg > /dev/null 1.78s user 0.14s system 100% cpu 1.917 total Slower than 'cat', but still a lot less that 86s. Dave