From: Navindra Umanee Date: 2005-03-11T17:23:50+09:00 Subject: Re: very slow IO (STDIN.gets and puts) on Linux, ruby 1.8.2_pre3 MiG wrote: > So the solution is maybe to use getc and parse lines on my own... Maybe you're missing the point. The two programs aren't doing the same amount of work; your benchmarks aren't equivalent. If you change the PHP benchmark slightly, you'll likely see PHP is just as slow as Ruby. [navindra@dot /tmp]$ time php -r 'while (fgets(STDIN));' < FILE 8.421u 2.334s 0:26.53 40.5% 0+0k 0+0io 2pf+0w [navindra@dot /tmp]$ time ruby -e 'while gets;end' < FILE 11.676u 2.586s 0:39.44 36.1% 0+0k 0+0io 11pf+0w [navindra@dot /tmp]$ time php -r 'while ($blah=fgets(STDIN));' < FILE 10.680u 2.372s 0:37.83 34.4% 0+0k 0+0io 10pf+0w Cheers, Navin.