On 03.06.2013 02:44, Tamara Temple wrote:
> So, basically, curl is getting a lot less data than Net::HTTP is
> getting. I haven't delved into why this is so, but these are 
> interesting
> stats:
>
>
> This is for the ruby version:
>
> Total fetch time:  28 seconds.
> Total fetch size:  1954452 bytes.
>
> real	0m28.175s
> user	0m0.224s
> sys	0m0.020s
>
>
>
> And this is for the PHP version:
>
> Total fetch time:  18 seconds.
> Total fetch bytes: 224888
>
> real	0m18.077s
> user	0m0.048s
> sys	0m0.028s
>
> Look at the difference in the amount of data transferred. Net::HTTP 
> is
> pulling in *eight times* as much data as curl is. Why is this the 
> case?
> That might be worth more investigation...
>
> But also look at the differences shown; the algorithms themselves 
> take
> nearly no time, which is to be expected.
>
> At any rate (haha, p.i.), you definitely can not make the case that 
> ruby
> is slower than php from this, as all the time is spent in transfer, 
> not
> execution.
>
> P.S. "Mick": I had to clean up your PHP script a bit as it was 
> tossing
> warnings and notices all over. Your ruby script, OTOH, was flawless. 
> I
> did change a couple things in order to get the totals, but not the
> fundamental algorithms.

My guess (totally untested) would be that curl/PHP is getting a gzipped 
version of the page whilst Net::HTTP is not.

-- 
Alex Gutteridge